django-cache-url
Use Cache URLs in your Django application.
What it is and what it does
django-cache-url is a lightweight Django utility that reads cache configuration from a CACHE_URL environment variable and translates it into Django's native CACHES dictionary format. It follows the 12-factor app pattern, making cache backend selection environment-driven rather than code-driven—useful for deploying the same codebase across development, staging, and production with different cache backends.
The package supports a wide range of cache backends including local memory, file-based, database, memcached variants, Redis (via django-redis), and uWSGI cache. It defaults to local memory cache if no CACHE_URL is set, making it safe to add to projects without immediate environment configuration. The library is intentionally minimal—it has no runtime dependencies and focuses solely on URL parsing and configuration translation.
Use it for:
- Deploying Django apps across multiple environments with different cache backends specified only via environment variables.
- Migrating between cache backends without changing application code, only the CACHE_URL.
- Supporting legacy projects already using django-cache-url or projects requiring multiple cache backend support with unified URL-based configuration.
- Containerized or cloud-deployed Django applications where cache configuration must be externalized from code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Configures Django cache backends from environment variables using the 12-factor app pattern, supporting multiple cache types (memcached, Redis, file, database, local memory) through a single CACHE_URL setting.
Yes, if you need URL-based cache configuration for non-Redis backends or are maintaining a legacy project already using this library. For new Django 4.2+ projects using only Redis, use Django's native RedisCache backend instead. The package is stable, dependency-free, and has no known vulnerabilities, but maintenance is aging—expect no active development, only maintenance fixes.
Install
django-cache-url on PyPI
pip
pip install django-cache-urluv
uv add django-cache-urlpoetry
poetry add django-cache-urlInstalling django-cache-url
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last release was 202 days ago—but the package is stable and the repository remains active. Suitable for established projects; new Redis-only projects should consider Django's native Redis support.
License in practice
MIT license (permissive) allows commercial and private use with minimal restrictions, making it safe for most Django projects.
Quickstart
pip install django-cache-url
# In settings.py
import django_cache_url
CACHES = {'default': django_cache_url.config()}
# Or parse a specific URL
CACHES = {'default': django_cache_url.parse('memcached://HOST:PORT')}
Verify before relying
- Whether the package actively maintains compatibility with Django 6.0 or if that classifier reflects aspirational support only.
- Performance characteristics when parsing complex multi-instance cache URLs at application startup.
- Specific port numbers and host configurations for different cache backends in production environments.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 202 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 226,447/month — #9,200 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_cache_url-3.4.6-py2.py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-environLoads and parses environment variables from…
permissive · top 5,000 on PyPI
django-redisProvides a Redis cache and session backend for…
permissive · top 5,000 on PyPI
fastapi-cache2Caches FastAPI endpoint and function results…
permissive · top 5,000 on PyPI
BeakerBeaker provides session management and caching…
permissive · top 15,000 on PyPI
django-valkeyProvides a Valkey cache and session backend for…
permissive · top 15,000 on PyPI
Redis-Sentinel-UrlParses redis:// and redis+sentinel:// URLs and…
permissive · top 15,000 on PyPI
aiocacheProvides asyncio-compatible caching with…
unclear · top 5,000 on PyPI
django-redis-sessionsProvides a Redis-backed session storage backend…
permissive · top 15,000 on PyPI
django-cacheopsAutomatic and manual ORM query caching for…
permissive · top 5,000 on PyPI
django-rqDjango-RQ integrates RQ (Redis Queue) with…
permissive · top 5,000 on PyPI