skillfed

django-redis

Full featured redis cache backend for Django.

django-redis v7.0.0 12.7M downloads/30d#1,312 on PyPI3,080
Permissive license BSD-3-Clause Active released

What it is and what it does

django-redis is a production-ready Redis cache and session backend for Django that replaces Django's default cache framework with Redis storage. It uses redis-py's native URL notation for connection strings, supporting TCP sockets, SSL-wrapped connections, and Unix domain sockets. The package handles serialization via pickle by default, offers pluggable compression (zlib, lzma, lz4, zstandard, gzip), and can emulate memcached exception behavior by ignoring Redis connection failures.

Typically used to improve Django application performance by offloading cache and session storage to Redis, it integrates directly into Django's CACHES and SESSION_ENGINE settings. The package supports Redis ACLs, primary/secondary failover in the default client, infinite timeouts, and raw access to the underlying redis connection pool for advanced use cases. It has been used in production across multiple projects and maintains a comprehensive test suite.

Use it for:

  • Replace Django's default in-memory cache with persistent Redis storage for multi-process deployments.
  • Store Django sessions in Redis for horizontal scaling across multiple application servers.
  • Enable cache compression to reduce memory usage on large cached objects.
  • Configure Redis failover and primary/secondary support for high-availability caching.
  • Use Unix domain sockets to cache locally without network overhead.
  • Emulate memcached behavior by ignoring Redis downtime to prevent application crashes.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Redis cache and session backend for Django, supporting native redis-py URL connection strings, pluggable serializers and parsers, and optional compression.

Yes. django-redis is actively maintained, production-proven, has no known vulnerabilities, low install friction, and a permissive license. It is the standard choice for Redis caching in Django projects that need persistence, scalability, or session sharing across servers. Install if you are using Django 5.2+ and have a Redis server available.

Install

django-redis on PyPI

pip

pip install django-redis

uv

uv add django-redis

poetry

poetry add django-redis

Installing django-redis

Before you install

Low install friction with a pure Python wheel. Actively maintained (last commit 2026-08-10) with production use across multiple projects. Requires Django 5.2+, redis 4.0.2+, and Python 3.10+.

License in practice

BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.

Quickstart

pip install django-redis

# In Django settings.py:
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379/1",
    }
}

# Use cache:
from django.core.cache import cache
cache.set('key', 'value')
value = cache.get('key')

Requires a running Redis server (2.8+) and Django 5.2+, Python 3.10+.

Verify before relying

  • Whether compression libraries (lz4, pyzstd) are automatically installed or optional dependencies.
  • Performance characteristics compared to other Django cache backends in typical workloads.
  • Specifics of how pluggable clients and parsers extend the default behavior.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — Django, redis, typing_extensions
Maintenance actively maintained — 73 days since the last release
Last repo commit
First released
Downloads 12,685,319/month — #1,312 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_redis-7.0.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: LibrariesTopic :: Utilities

Tags

django redis cache backendredis session storage djangodjango caching with redisredis-py django integrationdjango cache configurationredis connection pooling djangodjango cache invalidation
django-integrationcaching-layersession-storage

More Libraries packages