diff options
Diffstat (limited to 'docs/ref/contrib/staticfiles.txt')
| -rw-r--r-- | docs/ref/contrib/staticfiles.txt | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index 08fc23bdb1..a72e2ae286 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -60,11 +60,12 @@ specified by the :setting:`INSTALLED_APPS` setting. The :djadmin:`collectstatic` management command calls the :meth:`~django.contrib.staticfiles.storage.StaticFilesStorage.post_process` -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.ManifestStaticFilesStorage` -by default. +method of the ``staticfiles`` storage backend from :setting:`STORAGES` 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.ManifestStaticFilesStorage` by +default. By default, collected files receive permissions from :setting:`FILE_UPLOAD_PERMISSIONS` and collected directories receive permissions @@ -82,7 +83,7 @@ respectively. For example:: kwargs['directory_permissions_mode'] = 0o760 super().__init__(*args, **kwargs) -Then set the :setting:`STATICFILES_STORAGE` setting to +Then set the ``staticfiles`` storage backend in :setting:`STORAGES` setting to ``'path.to.MyStaticFilesStorage'``. Some commonly used options are: @@ -113,7 +114,8 @@ Some commonly used options are: Don't call the :meth:`~django.contrib.staticfiles.storage.StaticFilesStorage.post_process` - method of the configured :setting:`STATICFILES_STORAGE` storage backend. + method of the configured ``staticfiles`` storage backend from + :setting:`STORAGES`. .. django-admin-option:: --no-default-ignore @@ -360,7 +362,7 @@ attribute. It defaults to 5. To enable the ``ManifestStaticFilesStorage`` you have to make sure the following requirements are met: -* the :setting:`STATICFILES_STORAGE` setting is set to +* the ``staticfiles`` storage backend in :setting:`STORAGES` setting is set to ``'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'`` * the :setting:`DEBUG` setting is set to ``False`` * you've collected all your static files by using the @@ -381,9 +383,9 @@ If a file isn't found in the ``staticfiles.json`` manifest at runtime, a 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 -:setting:`STATICFILES_STORAGE` setting is set to something else like -``'django.contrib.staticfiles.storage.StaticFilesStorage'`` (the default). +as part of the normal test setup. During testing, ensure that ``staticfiles`` +storage backend in the :setting:`STORAGES` setting is set to something else +like ``'django.contrib.staticfiles.storage.StaticFilesStorage'`` (the default). .. method:: storage.ManifestStaticFilesStorage.file_hash(name, content=None) @@ -434,7 +436,8 @@ files: - The builtin template tag :ttag:`static` which takes a path and urljoins it with the static prefix :setting:`STATIC_URL`. If ``django.contrib.staticfiles`` is installed, the tag uses the ``url()`` - method of the :setting:`STATICFILES_STORAGE` instead. + method of the ``staticfiles`` storage backend from :setting:`STORAGES` + instead. - The builtin template tag :ttag:`get_static_prefix` which populates a template variable with the static prefix :setting:`STATIC_URL` to be @@ -443,6 +446,9 @@ files: - The similar template tag :ttag:`get_media_prefix` which works like :ttag:`get_static_prefix` but uses :setting:`MEDIA_URL`. +- The ``staticfiles`` key in :data:`django.core.files.storage.storages` + contains a ready-to-use instance of the staticfiles storage backend. + .. _staticfiles-development-view: Static file development view |
