summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/staticfiles.txt28
-rw-r--r--docs/ref/files/storage.txt13
-rw-r--r--docs/ref/settings.txt4
-rw-r--r--docs/releases/1.7.txt9
4 files changed, 50 insertions, 4 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
========
diff --git a/docs/ref/files/storage.txt b/docs/ref/files/storage.txt
index b9742514ea..bd8fa56787 100644
--- a/docs/ref/files/storage.txt
+++ b/docs/ref/files/storage.txt
@@ -29,13 +29,23 @@ Django provides two convenient ways to access the current storage class:
The FileSystemStorage Class
---------------------------
-.. class:: FileSystemStorage
+.. class:: FileSystemStorage([location=None, base_url=None, file_permissions_mode=None])
The :class:`~django.core.files.storage.FileSystemStorage` class implements
basic file storage on a local filesystem. It inherits from
:class:`~django.core.files.storage.Storage` and provides implementations
for all the public methods thereof.
+ .. attribute:: file_permissions_mode
+
+ The file system permissions that the file will receive when it is
+ saved. Defaults to :setting:`FILE_UPLOAD_PERMISSIONS`.
+
+ .. versionadded:: 1.7
+
+ The ``file_permissions_mode`` attribute was added. Previously files
+ always received :setting:`FILE_UPLOAD_PERMISSIONS` permissions.
+
.. note::
The ``FileSystemStorage.delete()`` method will not raise
@@ -81,7 +91,6 @@ The Storage Class
available for new content to be written to on the target storage
system.
-
.. method:: get_valid_name(name)
Returns a filename based on the ``name`` parameter that's suitable
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index 32a8237d3f..4b813a8ac7 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1159,6 +1159,10 @@ dependent behavior. On most platforms, temporary files will have a mode
of ``0600``, and files saved from memory will be saved using the
system's standard umask.
+This setting also determines the default permissions for collected static files
+when using the :djadmin:`collectstatic` management command. See
+:djadmin:`collectstatic` for details on overridding it.
+
.. warning::
**Always prefix the mode with a 0.**
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 7ce13066bf..9312aeaecb 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -226,6 +226,15 @@ Minor features
:class:`~django.middleware.http.ConditionalGetMiddleware` to handle
conditional ``GET`` requests for sitemaps which set ``lastmod``.
+:mod:`django.contrib.staticfiles`
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* The :ref:`static files storage classes <staticfiles-storages>` may be
+ subclassed to override the permissions that collected static files receive by
+ setting the
+ :attr:`~django.core.files.storage.FileSystemStorage.file_permissions_mode`
+ parameter. See :djadmin:`collectstatic` for example usage.
+
:mod:`django.contrib.syndication`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^