Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Django redis backend

Project Description

Django-redisdb is Redis backend for Django that allows using Redis as a cache and as a database at the same time. Django-redisdb provides backends for master/master and sharded configuration.


pip install django-redisdb

Quick usage guide


    'redis_ring': {
        'BACKEND': 'redisdb.backends.RedisRing',  # sharding backend
        'DB': 0,
        'LOCATION': [
    'redis_copy': {
        'BACKEND': 'redisdb.backends.RedisCopy',  # copying backend
        'DB': 0,
        'LOCATION': [


>>> from django.core.cache import caches
>>> caches['redis_ring'].set('one_key', 123)  # set key1 only on on server
>>> caches['redis_copy'].set('other_key', 234)  # set key2 on all servers
[True, True]

With RedisRing value is set only on one node. With RedisCopy it’s set on all nodes (two nodes in examle above).

Redis is much more powerfull then simple cache. It should be seen as a specialized database. With django-redisdb you can use all its power. For example you can use redis’ sorted sets:

>>> caches['redis_copy'].zadd('myzset', 1, 'one')
[0, 1]
>>> caches['redis_copy'].zadd('myzset', 2, 'two')
[0, 1]
>>> caches['redis_copy'].zadd('myzset', 3, 'three')
[0, 1]
>>> caches['redis_copy'].zrange('myzset', 0, -1)
['one', 'two', 'three']
>>> caches['redis_copy'].zrange('myzset', 0, -1, withscores=True)
[('one', 1.0), ('two', 2.0), ('three', 3.0)]

Supported Django versions

django-redisdb runs on Django 1.2 to Django 1.8


Full documentation is available at

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(7.1 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Jul 6, 2015
(5.1 kB) Copy SHA256 Hash SHA256
Source None Jul 6, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers