mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #28606 -- Deprecated CachedStaticFilesStorage.
This commit is contained in:
@@ -26,6 +26,9 @@ details on these changes.
|
||||
|
||||
* The ``FILE_CHARSET`` setting will be removed.
|
||||
|
||||
* ``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` will be
|
||||
removed.
|
||||
|
||||
.. _deprecation-removed-in-3.0:
|
||||
|
||||
3.0
|
||||
|
||||
@@ -62,7 +62,7 @@ The :djadmin:`collectstatic` management command calls the
|
||||
method of the :setting:`STATICFILES_STORAGE` after each run and passes
|
||||
a list of paths that have been found by the management command. It also
|
||||
receives all command line options of :djadmin:`collectstatic`. This is used
|
||||
by the :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
|
||||
by the :class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage`
|
||||
by default.
|
||||
|
||||
By default, collected files receive permissions from
|
||||
@@ -229,9 +229,7 @@ local development, should **never be used in production** and is only
|
||||
available if the :doc:`staticfiles </ref/contrib/staticfiles>` app is
|
||||
in your project's :setting:`INSTALLED_APPS` setting.
|
||||
|
||||
``--insecure`` doesn't work with
|
||||
:class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage` or
|
||||
:class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`.
|
||||
``--insecure`` doesn't work with :class:`~.storage.ManifestStaticFilesStorage`.
|
||||
|
||||
Example usage::
|
||||
|
||||
@@ -262,7 +260,7 @@ line options. It yields tuples of three values:
|
||||
``processed`` is a boolean indicating whether or not the value was
|
||||
post-processed, or an exception if post-processing failed.
|
||||
|
||||
The :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
|
||||
The :class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage`
|
||||
uses this behind the scenes to replace the paths with their hashed
|
||||
counterparts and update the cache appropriately.
|
||||
|
||||
@@ -362,6 +360,13 @@ hashing algorithm.
|
||||
|
||||
.. class:: storage.CachedStaticFilesStorage
|
||||
|
||||
.. deprecated:: 2.1
|
||||
|
||||
``CachedStaticFilesStorage`` is deprecated as it has some intractable
|
||||
problems, some of which are outlined below. Use
|
||||
:class:`~storage.ManifestStaticFilesStorage` or a third-party cloud storage
|
||||
instead.
|
||||
|
||||
``CachedStaticFilesStorage`` is a similar class like the
|
||||
:class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage` class
|
||||
but uses Django's :doc:`caching framework</topics/cache>` for storing the
|
||||
|
||||
@@ -466,15 +466,12 @@ files from a cloud service<staticfiles-from-cdn>`.
|
||||
--------------------------------------------
|
||||
|
||||
The :mod:`staticfiles<django.contrib.staticfiles>` contrib app now has a
|
||||
:class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage` backend
|
||||
``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` backend
|
||||
that 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.
|
||||
|
||||
Simple clickjacking protection
|
||||
------------------------------
|
||||
|
||||
|
||||
@@ -506,8 +506,7 @@ Minor features
|
||||
and :attr:`~django.core.files.storage.FileSystemStorage.directory_permissions_mode`
|
||||
parameters. See :djadmin:`collectstatic` for example usage.
|
||||
|
||||
* The :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
|
||||
backend gets a sibling class called
|
||||
* The ``CachedStaticFilesStorage`` backend gets a sibling class called
|
||||
:class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage`
|
||||
that doesn't use the cache system at all but instead a JSON file called
|
||||
``staticfiles.json`` for storing the mapping between the original file name
|
||||
|
||||
@@ -354,3 +354,7 @@ Miscellaneous
|
||||
|
||||
* The ``FILE_CHARSET`` setting is deprecated. Starting with Django 3.1, files
|
||||
read from disk must be UTF-8 encoded.
|
||||
|
||||
* ``django.contrib.staticfiles.storage.CachedStaticFilesStorage`` is
|
||||
deprecated due to the intractable problems that is has. Use
|
||||
:class:`.ManifestStaticFilesStorage` or a third-party cloud storage instead.
|
||||
|
||||
@@ -290,13 +290,13 @@ Static files
|
||||
Static files, which by definition are not dynamic, make an excellent target for
|
||||
optimization gains.
|
||||
|
||||
:class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
:class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
By taking advantage of web browsers' caching abilities, you can
|
||||
eliminate network hits entirely for a given file after the initial download.
|
||||
|
||||
:class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage` appends a
|
||||
:class:`~django.contrib.staticfiles.storage.ManifestStaticFilesStorage` appends a
|
||||
content-dependent tag to the filenames of :doc:`static files
|
||||
</ref/contrib/staticfiles>` to make it safe for browsers to cache them
|
||||
long-term without missing future changes - when a file changes, so will the
|
||||
|
||||
Reference in New Issue
Block a user