Django Using Redis with Django - Caching Backend Using django-redis


Example

One potential implementation of Redis as a backend caching utility is the django-redis package.

This example assumes you already have a Redis server operating.

$ pip install django-redis

Edit your settings.py to include a CACHES object (see Django documentation on caching).

CACHES = {
    'default': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379/1',
        'OPTIONS': {
            'CLIENT_CLASS': 'django_redis.client.DefaultClient',
        }
    }
}