This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

.. image::

django-last-modified is a collection of Django middleware to help
manage your caching setup.

If you're familiar with the following HTTP headers:

- Cache-Control
- Expires
- Last-Modified
- ETag
- If-Modified-Since
- If-None-Match

You can probably skip down to "Installation."

Otherwise, you can find a primer on HTTP caching located `here
<https:"" edavis="" django-last-modified="" blob="" master="" introduction.rst="">`_.


1) ``$ pip install django-last-modified``

2) Add ``CacheControlMiddleware`` and ``LastModifiedMiddleware`` to

``CacheControlMiddleware`` adds the Cache-Control and Expires headers
to outgoing responses while ``LastModifiedMiddleware`` adds the
Last-Modified/ETag header and performs the
If-Modified-Since/If-None-Match checking.

Here's a recommended MIDDLEWARE_CLASSES order:

.. code-block:: python

# ... snip ...

If a request is authenticated (i.e., the user has logged in) the
If-Modified-Since checking is skipped.

django-last-modified doesn't need to be added to INSTALLED_APPS.


String path to a function (e.g., '') that
is called to obtain the "last modified" value. Must return either a
datetime/date object or a UNIX timestamp. *Default:* None, must be

Number of seconds stored representation is considered fresh for
private caches. *Default:* 3600 seconds (one hour).

Same as CACHE_MAX_AGE but for public caches. *Default:* Value of

Set to True to disable the respective middleware from being
applied. Provided so you can toggle middleware off/on without having
to tweak MIDDLEWARE_CLASSES. *Default:* False.

Doesn't Django already have this?

Django has two features *like* this, but they're slightly different.

The `update and fetch
<https:"" en="" 1.4="" topics="" cache="" #the-per-site-cache="">`_
cache middleware sets the Cache-Control, Expires, and Last-Modified
headers but in the process also stores the generated pages in the
server-side cache. The project I was working on had many thousand
"long-tail" pages that I didn't want/need polluting any caches.

There's also "`conditional view processing
<https:"" en="" 1.4="" topics="" conditional-view-processing=""/>`_"
which is even closer to what I needed, but can only be applied on a
per-view basis while I needed the whole site covered.

In a nutshell, I wanted the whole site covered (like the cache
middleware does) but only generating HTTP headers and not involving
the server-side cache (like the conditional view processing).

Unable to find an existing app to do this, django-last-modified was


Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-last-modified-0.1.tar.gz (5.0 kB) Copy SHA256 Checksum SHA256 Source Nov 19, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting