summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorDavid Sanders <dsanders11@ucsbalum.com>2017-01-11 07:21:29 -0700
committerTim Graham <timograham@gmail.com>2017-01-11 09:21:29 -0500
commit53bffe8d03f01bd3214a5404998cb965fb28cd0b (patch)
tree48a5f276f9bab5c3dcaa74104307431c1c65781a /docs/ref
parent7156a6c9c47fe599207673e1653b056cc46082f6 (diff)
Fixed #24452 -- Fixed HashedFilesMixin correctness with nested paths.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/staticfiles.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt
index 1c6e36515a..b8d91fddb8 100644
--- a/docs/ref/contrib/staticfiles.txt
+++ b/docs/ref/contrib/staticfiles.txt
@@ -293,6 +293,24 @@ content:
@import url("../admin/css/base.27e20196a850.css");
+.. attribute:: storage.ManifestStaticFilesStorage.max_post_process_passes
+
+Since static files might reference other static files that need to have their
+paths replaced, multiple passes of replacing paths may be needed until the file
+hashes converge. To prevent an infinite loop due to hashes not converging (for
+example, if ``'foo.css'`` references ``'bar.css'`` which references
+``'foo.css'``) there is a maximum number of passes before post-processing is
+abandoned. In cases with a large number of references, a higher number of
+passes might be needed. Increase the maximum number of passes by subclassing
+``ManifestStaticFilesStorage`` and setting the ``max_post_process_passes``
+attribute. It defaults to 5.
+
+.. versionchanged:: 1.11
+
+ Previous versions didn't make multiple passes to ensure file hashes
+ converged, so often times file hashes weren't correct. The
+ ``max_post_process_passes`` attribute was added.
+
To enable the ``ManifestStaticFilesStorage`` you have to make sure the
following requirements are met:
@@ -315,6 +333,18 @@ hashed names for all processed files in a file called ``staticfiles.json``.
This happens once when you run the :djadmin:`collectstatic` management
command.
+.. attribute:: storage.ManifestStaticFilesStorage.manifest_strict
+
+If a file isn't found in the ``staticfiles.json`` manifest at runtime, a
+``ValueError`` is raised. This behavior can be disabled by subclassing
+``ManifestStaticFilesStorage`` and setting the ``manifest_strict`` attribute to
+``False`` -- nonexistent paths will remain unchanged.
+
+.. versionchanged:: 1.11
+
+ The ``manifest_strict`` attribute was added. In older versions, the
+ behavior is the same as ``manifest_strict=False``.
+
Due to the requirement of running :djadmin:`collectstatic`, this storage
typically shouldn't be used when running tests as ``collectstatic`` isn't run
as part of the normal test setup. During testing, ensure that the
@@ -350,6 +380,16 @@ If you want to override certain options of the cache backend the storage uses,
simply specify a custom entry in the :setting:`CACHES` setting named
``'staticfiles'``. It falls back to using the ``'default'`` cache backend.
+.. warning::
+
+ ``CachedStaticFilesStorage`` isn't recommended -- in almost all cases
+ ``ManifestStaticFilesStorage`` is a better choice. There are several
+ performance penalties when using ``CachedStaticFilesStorage`` since a cache
+ miss requires hashing files at runtime. Remote file storage require several
+ round-trips to hash a file on a cache miss, as several file accesses are
+ required to ensure that the file hash is correct in the case of nested file
+ paths.
+
Finders Module
==============