skillfed

django-cache-url

Use Cache URLs in your Django application.

django-cache-url v3.4.6 226.4K downloads/30d#9,200 on PyPI20
Permissive license MIT AGING released

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-url

uv

uv add django-cache-url

poetry

poetry add django-cache-url

Installing 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

Development Status :: 5 - Production/StableFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

django cache url configurationenvironment variable cache setup12factor django cachingmemcached redis configurationdjango cache backend parser
configuration-managementtwelve-factor

More Dynamic Content packages