Skip to main content

Django redis backend

Project description


Provide Redis backends for Django that faciliates using multiple Redis servers in the same time like if they were in master/master or sharded configuration.


Install requirements:

pip install redis hash_ring

Install Kido Redis:

pip install django-kidoredis

or current development version:

pip install hg+https:://


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

Redis is configured as cache backend although it should be treat as specialized database. There are two backends:


After configuration access to Redis is done like to any other Django cache:

from django.core.cache import caches
caches['redis_ring'].set('key1', 1)  # set key1 only on on server
caches['redis_copy'].set('key2', 2)  # set key2 on all servers
result_list = caches['redis_copy'].zrange('key3', 1, 10)  # redis only command


RedisCopy can save data to many nodes. Each of this nodes can return different result on save. For that reason commands that save data to nodes returns list of results from each node. E.g. with two nodes set for redis_copy:

>>> print caches['redis_copy'].set('key1', 2)
[True, True]

Supported Django versions

Tested with:

  • Django 1.2.7 on python2.7

  • Django 1.3.7 on python2.7

  • Django 1.4.16 on python2.7

  • Django 1.5.11 on python2.7, python3.4

  • Django 1.6.8 on python2.7, python3.4

  • Django 1.7.1 on python2.7, python3.4

Project details

Download files

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

Source Distribution

django-kidoredis-1.0.1.tar.gz (56.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page