Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #22347 FileSystemStorage documentation unified #2506

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/ref/files/storage.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ The FileSystemStorage Class
:class:`~django.core.files.storage.Storage` and provides implementations :class:`~django.core.files.storage.Storage` and provides implementations
for all the public methods thereof. for all the public methods thereof.


.. attribute:: location

Absolute path to the directory that will hold the files.
Defaults to the value of your :setting:`MEDIA_ROOT` setting.

.. attribute:: base_url

URL that serves the files stored at this location.
Defaults to the value of your :setting:`MEDIA_URL` setting.

.. attribute:: file_permissions_mode .. attribute:: file_permissions_mode


The file system permissions that the file will receive when it is The file system permissions that the file will receive when it is
Expand Down
15 changes: 2 additions & 13 deletions docs/topics/files.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -149,20 +149,9 @@ See :doc:`/ref/files/storage` for the file storage API.
The built-in filesystem storage class The built-in filesystem storage class
------------------------------------- -------------------------------------


Django ships with a built-in ``FileSystemStorage`` class (defined in Django ships with a built-in :class:`~django.core.files.storage.FileSystemStorage` class (defined in
``django.core.files.storage``) which implements basic local filesystem file ``django.core.files.storage``) which implements basic local filesystem file
storage. Its initializer takes two arguments: storage.

====================== ===================================================
Argument Description
====================== ===================================================
``location`` Optional. Absolute path to the directory that will
hold the files. If omitted, it will be set to the
value of your :setting:`MEDIA_ROOT` setting.
``base_url`` Optional. URL that serves the files stored at this
location. If omitted, it will default to the value
of your :setting:`MEDIA_URL` setting.
====================== ===================================================


For example, the following code will store uploaded files under For example, the following code will store uploaded files under
``/media/photos`` regardless of what your :setting:`MEDIA_ROOT` setting is:: ``/media/photos`` regardless of what your :setting:`MEDIA_ROOT` setting is::
Expand Down