Fixed #15252 -- Added static template tag and CachedStaticFilesStorage to staticfiles contrib app.

Many thanks to Florian Apolloner and Jacob Kaplan-Moss for reviewing and eagle eyeing.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2011-08-11 14:07:39 +00:00
parent e9a909e30a
commit 1d32bdd3c9
33 changed files with 646 additions and 148 deletions

View file

@ -212,6 +212,29 @@ Additionally, it's now possible to define translatable URL patterns using
:ref:`url-internationalization` for more information about the language prefix
and how to internationalize URL patterns.
``static`` template tag
~~~~~~~~~~~~~~~~~~~~~~~
The :mod:`staticfiles<django.contrib.staticfiles>` contrib app has now a new
:ttag:`static template tag<staticfiles-static>` to refer to files saved with
the :setting:`STATICFILES_STORAGE` storage backend. It'll use the storage
``url`` method and therefore supports advanced features such as
:ref:`serving files from a cloud service<staticfiles-from-cdn>`.
``CachedStaticFilesStorage`` storage backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Additional to the `static template tag`_ the
:mod:`staticfiles<django.contrib.staticfiles>` contrib app now has a
:class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage` which
caches the files it saves (when running the :djadmin:`collectstatic`
management command) by appending the MD5 hash of the file's content to the
filename. For example, the file ``css/styles.css`` would also be saved as
``css/styles.55e7cbb9ba48.css``
See the :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
docs for more information.
Minor features
~~~~~~~~~~~~~~