diff options
Diffstat (limited to 'docs/ref/contrib')
| -rw-r--r-- | docs/ref/contrib/staticfiles.txt | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index 1a9fd25ca9..c65533fa0f 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -32,8 +32,6 @@ following settings: Management Commands =================== -.. highlight:: console - ``django.contrib.staticfiles`` exposes three management commands. collectstatic @@ -61,6 +59,30 @@ receives all command line options of :djadmin:`collectstatic`. This is used by the :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage` by default. +By default, collected files receive permissions from +:setting:`FILE_UPLOAD_PERMISSIONS`. If you would like different permissions for +these files, you can subclass either of the :ref:`static files storage +classes <staticfiles-storages>` and specify the ``file_permissions_mode`` +parameter. For example:: + + from django.contrib.staticfiles import storage + + class MyStaticFilesStorage(storage.StaticFilesStorage): + def __init__(self, *args, **kwargs): + kwargs['file_permissions_mode'] = 0o640 + super(CustomStaticFilesStorage, self).__init__(*args, **kwargs) + +Then set the :setting:`STATICFILES_STORAGE` setting to +``'path.to.MyStaticFilesStorage'``. + +.. versionadded:: 1.7 + + The ability to override ``file_permissions_mode`` is new in Django 1.7. + Previously the file permissions always used + :setting:`FILE_UPLOAD_PERMISSIONS`. + +.. highlight:: console + Some commonly used options are: .. django-admin-option:: --noinput @@ -174,6 +196,8 @@ Example usage:: django-admin.py runserver --insecure +.. _staticfiles-storages: + Storages ======== |
