Skip to content

Instantly share code, notes, and snippets.

@atatsu
Created October 24, 2012 17:26
Show Gist options
  • Save atatsu/3947495 to your computer and use it in GitHub Desktop.
Save atatsu/3947495 to your computer and use it in GitHub Desktop.
Django/Redis session storage as json
import json
from redis_sessions.session import SessionStore as RedisSessionStore
class SessionStore(RedisSessionStore):
def encode(self, session_dict):
json_ = json.dumps(session_dict)
return json_
def decode(self, session_data):
return json.loads(session_data)
#in settings.py
SESSION_ENGINE = 'path.to.module.session'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment