NickBraunagel
NickBraunagel

Reputation: 1599

Django: Limit to size of database-backed sessions?

Django's documentation (here) state that cookie-based sessions can exceed the 'standard' of 4096 bytes per cookies.

What about database-backed sessions, is there a limit to the amount of data that can be stored in the session? I didn't see anything in the documentation, nor on SO.

For my project, I'll need to save ~50KB to a user's database-backed session. Let me know if you need more info.

Upvotes: 4

Views: 2016

Answers (1)

solarissmoke
solarissmoke

Reputation: 31404

The database backend stores the session data in a TextField in the database.

The size limit of this field depends on your database backend, e.g., for Postgres (stored as text) it is unlimited, and for MySQL (stored as longtext) it is approximately 4GB.

Either way the limit is going to be far higher than ~50KB!

Upvotes: 5

Related Questions