summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorVajrasky Kok <sky.kok@speaklikeaking.com>2013-11-05 18:02:54 +0800
committerTim Graham <timograham@gmail.com>2013-11-29 08:01:30 -0500
commit7e2d61a9724644d6d1c7ce9361d9fd5be3e2ab86 (patch)
tree294d13ea68cd5125832407619ad07056494675d1 /docs
parent42ac13800952e74e3969b850fa635b400948c5ee (diff)
Fixed #21380 -- Added a way to set different permission for static directories.
Previously when collecting static files, the directories would receive permissions from the global umask. Now the default permission comes from FILE_UPLOAD_DIRECTORY_PERMISSIONS and there's an option to specify the permissions by subclassing any of the static files storage classes and setting the directory_permissions_mode parameter.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/staticfiles.txt18
-rw-r--r--docs/ref/files/storage.txt13
-rw-r--r--docs/ref/settings.txt14
-rw-r--r--docs/releases/1.7.txt7
4 files changed, 37 insertions, 15 deletions
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt
index c65533fa0f..3202321269 100644
--- a/docs/ref/contrib/staticfiles.txt
+++ b/docs/ref/contrib/staticfiles.txt
@@ -60,16 +60,19 @@ 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::
+:setting:`FILE_UPLOAD_PERMISSIONS` and collected directories receive permissions
+from :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`. If you would like different
+permissions for these files and/or directories, you can subclass either of the
+:ref:`static files storage classes <staticfiles-storages>` and specify the
+``file_permissions_mode`` and/or ``directory_permissions_mode`` parameters,
+respectively. For example::
from django.contrib.staticfiles import storage
class MyStaticFilesStorage(storage.StaticFilesStorage):
def __init__(self, *args, **kwargs):
kwargs['file_permissions_mode'] = 0o640
+ kwargs['directory_permissions_mode'] = 0o760
super(CustomStaticFilesStorage, self).__init__(*args, **kwargs)
Then set the :setting:`STATICFILES_STORAGE` setting to
@@ -77,9 +80,10 @@ Then set the :setting:`STATICFILES_STORAGE` setting to
.. 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`.
+ The ability to override ``file_permissions_mode`` and
+ ``directory_permissions_mode`` is new in Django 1.7. Previously the file
+ permissions always used :setting:`FILE_UPLOAD_PERMISSIONS` and the directory
+ permissions always used :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`.
.. highlight:: console
diff --git a/docs/ref/files/storage.txt b/docs/ref/files/storage.txt
index bd8fa56787..6d367b70fc 100644
--- a/docs/ref/files/storage.txt
+++ b/docs/ref/files/storage.txt
@@ -29,7 +29,7 @@ Django provides two convenient ways to access the current storage class:
The FileSystemStorage Class
---------------------------
-.. class:: FileSystemStorage([location=None, base_url=None, file_permissions_mode=None])
+.. class:: FileSystemStorage([location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None])
The :class:`~django.core.files.storage.FileSystemStorage` class implements
basic file storage on a local filesystem. It inherits from
@@ -46,6 +46,17 @@ The FileSystemStorage Class
The ``file_permissions_mode`` attribute was added. Previously files
always received :setting:`FILE_UPLOAD_PERMISSIONS` permissions.
+ .. attribute:: directory_permissions_mode
+
+ The file system permissions that the directory will receive when it is
+ saved. Defaults to :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS`.
+
+ .. versionadded:: 1.7
+
+ The ``directory_permissions_mode`` attribute was added. Previously
+ directories always received
+ :setting:`FILE_UPLOAD_DIRECTORY_PERMISSIONS` permissions.
+
.. note::
The ``FileSystemStorage.delete()`` method will not raise
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index c99a7e4347..a1207fb0f8 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1135,9 +1135,15 @@ FILE_UPLOAD_DIRECTORY_PERMISSIONS
Default: ``None``
-The numeric mode to apply to directories created in the process of
-uploading files. This value mirrors the functionality and caveats of
-the :setting:`FILE_UPLOAD_PERMISSIONS` setting.
+The numeric mode to apply to directories created in the process of uploading
+files.
+
+This setting also determines the default permissions for collected static
+directories when using the :djadmin:`collectstatic` management command. See
+:djadmin:`collectstatic` for details on overriding it.
+
+This value mirrors the functionality and caveats of the
+:setting:`FILE_UPLOAD_PERMISSIONS` setting.
.. setting:: FILE_UPLOAD_PERMISSIONS
@@ -1157,7 +1163,7 @@ 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.
+:djadmin:`collectstatic` for details on overriding it.
.. warning::
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 8d130f9585..9cb907aded 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -256,10 +256,11 @@ Minor features
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* The :ref:`static files storage classes <staticfiles-storages>` may be
- subclassed to override the permissions that collected static files receive by
- setting the
+ subclassed to override the permissions that collected static files and
+ directories receive by setting the
:attr:`~django.core.files.storage.FileSystemStorage.file_permissions_mode`
- parameter. See :djadmin:`collectstatic` for example usage.
+ and :attr:`~django.core.files.storage.FileSystemStorage.directory_permissions_mode`
+ parameters. See :djadmin:`collectstatic` for example usage.
:mod:`django.contrib.syndication`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^