Beefier Cache-Control HTTP headers created by @never_cache decorator in Django.
Project description
django-beefycachecontrol is a Django middleware that smacks misbehaving upstream caches into submission with beefier anti-cache HTTP headers.
Normally, when a view is decorated with @never_cache:
@never_cache def my_view(request): ...
The resulting HTTP headers (among other things) include:
Cache-Control max-age=0
While this should be sufficient to prevent the response from being cached upstream, but there may be circumstances where this is not enough. Enter django-beefiercachecontrol!
With BeefyCacheControlMiddleware enabled, these HTTP headers become:
Cache-Control max-age=0, no-cache, no-store
Cache that and you’d be arrested by the internet cops!
Installation
easy_install django-beefycachecontrol or pip install django-beefycachecontrol
Add beefycachecontrol to your INSTALLED_APPS
In settings.py add 'beefycachecontrol.middleware.BeefyCacheControlMiddleware' to MIDDLEWARE_CLASSES
Usage
django-beefycachecontrol is a middleware. Once it is enabled, there is nothing more to do. It simply fixes up your no-cache related HTTP headers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-beefycachecontrol-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21d207466497657c3c897714a5cb4bd5f3c41d788145ecf7a43ef52d7e35684c |
|
MD5 | 68eefd8b6cf326df03dc130d40bd9c6b |
|
BLAKE2b-256 | e44139c4db4f60ae671e23d1e4a7cf7beb7c3240c0043a7d99c2311112c3a222 |