1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #26029 -- Allowed configuring custom file storage backends.

This commit is contained in:
Jarosław Wygoda
2023-01-11 10:48:57 +01:00
committed by Mariusz Felisiak
parent d02a9f0cee
commit 1ec3f0961f
12 changed files with 209 additions and 11 deletions

View File

@@ -116,3 +116,23 @@ free unique filename cannot be found, a :exc:`SuspiciousFileOperation
If a file with ``name`` already exists, ``get_alternative_name()`` is called to
obtain an alternative name.
.. _using-custom-storage-engine:
Use your custom storage engine
==============================
.. versionadded:: 4.2
The first step to using your custom storage with Django is to tell Django about
the file storage backend you'll be using. This is done using the
:setting:`STORAGES` setting. This setting maps storage aliases, which are a way
to refer to a specific storage throughout Django, to a dictionary of settings
for that specific storage backend. The settings in the inner dictionaries are
described fully in the :setting:`STORAGES` documentation.
Storages are then accessed by alias from from the
:data:`django.core.files.storage.storages` dictionary::
from django.core.files.storage import storages
example_storage = storages["example"]