Configurable file storages for Django
Project description
django-filestorages
Django-getstorage is a tiny Python library for dealing with configurable Django storages.
It allows you to define a dictionary of file storage configurations
in your settings and refer to them by name in your code.
It should be obsolete once Django ticket 26029 is resolved.
Installation
Use the package manager pip to install django-filestorages.
pip install django-filestorages
Usage
Wherever you need a storage, use the filestorages.get_storage function.
from filestorages import get_storage
file = models.FileField(storage=get_storage('some.configured.storage'))
In your settings, you can define your storages using dotted paths:
FILE_STORAGES = {
'default': {
'BACKEND': "django.core.files.storage.FileSystemStorage",
'OPTIONS': {
'location': '/path/to/the/files/',
'base_url': '/files/',
}
},
'some': {
'BACKEND': 'other.backend.Storage',
'OPTIONS': {
'option': 'value',
},
},
'some.configured': {
'OPTIONS': {
'second_option': True,
},
},
}
In this example get_storage('some.configured.storage') returns other.backend.Storage(option='value', second_option=True)
If no matching backend is found, FILE_STORAGES['default'] is used, falling back on
DEFAULT_FILE_STORAGE if not set.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-filestorages-0.1.tar.gz.
File metadata
- Download URL: django-filestorages-0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0b4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fe6c352d48fd2ce70c76aef6dc33d9ece0e28c2fdc2c100aab762c753e010af
|
|
| MD5 |
72735a7c30be877157903b460378c7b2
|
|
| BLAKE2b-256 |
f47f9fdfca1d1f8f796d3585dd87011d22ad3f6a03dc582a08dcc532257fc958
|
File details
Details for the file django_filestorages-0.1-py3-none-any.whl.
File metadata
- Download URL: django_filestorages-0.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0b4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53d1543314438fa91a63538e66fbb2860d547e3f56c0aa1548f34088ee4b0f79
|
|
| MD5 |
85e748f3f361aa26a1a9ce6fd3f34dc2
|
|
| BLAKE2b-256 |
cb84ad26f495fee94b8e1a81309d5cd3055bb433e54a994e65f072950cc954d6
|