Created
October 24, 2012 17:26
-
-
Save atatsu/3947495 to your computer and use it in GitHub Desktop.
Django/Redis session storage as json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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