mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #21219 -- Added a way to set different permission for static files.
Previously, when collecting static files, the files would receive permission from FILE_UPLOAD_PERMISSIONS. Now, there's an option to give different permission from uploaded files permission by subclassing any of the static files storage classes and setting the file_permissions_mode parameter. Thanks dblack at atlassian.com for the suggestion.
This commit is contained in:
parent
c052699be3
commit
9eecb91695
7 changed files with 105 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue