Will & Skill Developers

Will & Skill Developers


Thoughts, snippets and ideas from the team at Will & Skill AB, Stockholm.

Faisal Mahmud
Author

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Share


Redis as a session backend for Django based projects

Faisal MahmudFaisal Mahmud

Redis is a popular key-value storage engine that can be used to store Django sessions.


Install Redis on Ubuntu

$ sudo apt-get install redis-server

Check to see that Redis server has been installed properly

$ redis-server --version

Install django-redis-session in your virtualenv

$ pip install django-redis-sessions

In your settings.py add the snippet below

SESSION_ENGINE = 'redis_sessions.session'

Additional settings can be added as below

SESSION_REDIS_HOST = 'localhost'
SESSION_REDIS_PORT = 6379
SESSION_REDIS_DB = 0
SESSION_REDIS_PASSWORD = 'password'
SESSION_REDIS_PREFIX = 'session'
Faisal Mahmud
Author

Faisal Mahmud

“The mind is not a vessel to be filled, but a fire to be kindled.” ― Plutarch

Comments