django-custom-storage 
GitHub

Test

Check Demo Project
- Check the demo repo on GitHub
Requirements
- Python 3.10+ supported.
- Django 4.2+ supported.
Setup
- Install from pip:
pip install django-custom-storage
- Modify
settings.pyby adding the app toINSTALLED_APPS:
INSTALLED_APPS = [
# ...
"compressor",
"custom_storage",
# ...
]
- Configure storage in
settings.py. The package ships sensible defaults and reads the project specifics fromAPP_CONFIG["custom_storage"]; callapply_storage_defaultsat the end of the file so theSTORAGES, compression and AWS settings are derived for you:
# Project paths (kept in the project; not owned by the package)
MEDIA_ROOT = "/var/opt/your_project_name/mediaroot/"
STATIC_ROOT = "/var/cache/your_project_name/staticroot/"
# AWS credentials
AWS_ACCESS_KEY_ID = "YOUR_PROJECT_AWS_ACCESS_KEY_ID"
AWS_SECRET_ACCESS_KEY = "YOUR_PROJECT_AWS_SECRET_ACCESS_KEY"
# Project-specific options; everything else falls back to the package defaults.
APP_CONFIG = {
"custom_storage": {
"BUCKET_NAME": "your_project_bucket_name",
"CUSTOM_DOMAIN": "cdn.your_project_bucket_name.com",
# Optional overrides: FILE_EXPIRE, DEFAULT_ACL, PRIVATE_LOCATION, ...
},
}
from custom_storage.conf import apply_storage_defaults
apply_storage_defaults(globals())
Top-level Django settings always win, so projects that already declare STORAGES,
COMPRESS_* or AWS_* keep working unchanged. To serve assets from the local
filesystem (handy in development) start the server with --force-local-storage or set
FORCE_LOCAL_STORAGE = True.
See Settings for every available key and
Storage classes for the backends, including the
private storage that serves non-public uploads through signed, expiring URLs.
Run Example Project
git clone --depth=50 --branch=django-custom-storage https://github.com/DLRSP/example.git DLRSP/example
cd DLRSP/example
python manage.py runserver
Now browser the app @ http://127.0.0.1:8000
Release files for django-custom-storage 0.3.30
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_custom_storage-0.3.30.tar.gz | 42.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_custom_storage-0.3.30-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 115.2 kB
Release files / django_custom_storage-0.3.30.tar.gz
| Download URL | django_custom_storage-0.3.30.tar.gz |
|---|---|
| Size | 42.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c67829041503e6cc42fe442c629a84248f7f0fe854facc980a4c7d2e13c859c3
|
|
BLAKE2b-256 checksum How to use checksums |
0c4bf8d1a6a69ae92485f75dd66081a6d6eed25c7df86acab60905931251da31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / django_custom_storage-0.3.30-py3-none-any.whl
| Download URL | django_custom_storage-0.3.30-py3-none-any.whl |
|---|---|
| Size | 73.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f3856bb78bac6c11561ecffdca41f136612af5d7454a3c5fd01b3a3cda3f849
|
|
BLAKE2b-256 checksum How to use checksums |
f362f20066c424d7afe796626e3f0defd89cdc00fc773b99547b17f59c2f2a43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|