Sessions¶
- class django_orjson.sessions.OrjsonSerializer[source]¶
An orjson-based session serializer, replacing Django’s built-in
JSONSerializer.Configure it in your settings:
SESSION_SERIALIZER = "django_orjson.sessions.OrjsonSerializer"
Warning
One-way migration
Migrating from Django’s
JSONSerializertoOrjsonSerializeris safe, but the reverse case is not.Sessions written by
JSONSerializercan be read byOrjsonSerializerwithout issue. But sessions written byOrjsonSerializercan be silently misread byJSONSerializer.See the note in Signing for more information—Django’s session
JSONSerializeris a re-export of the signing one, so they share this limitation.