Django application provide custom storage uses S3 and Compressor.
Project description
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
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_custom_storage-0.3.3.tar.gz.
File metadata
- Download URL: django_custom_storage-0.3.3.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0866a306e1291d0c34107330ed70cd1e0b17526773fafc089319286b3602b399
|
|
| MD5 |
03971f6b82dc1590011300f55712bbe3
|
|
| BLAKE2b-256 |
131e62a9d93c7bfa7c48d86f200b528255ff617ba229749bb7e09cad133af5dc
|
File details
Details for the file django_custom_storage-0.3.3-py3-none-any.whl.
File metadata
- Download URL: django_custom_storage-0.3.3-py3-none-any.whl
- Upload date:
- Size: 71.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2aa05652ac7cc358e2c2db6ee9e154337ef61470b612d5ca8975d1c5fca5d48c
|
|
| MD5 |
3be777564784308783e73f2997505006
|
|
| BLAKE2b-256 |
9c0002ed05a507c2cbba657841028bc6f575a205c22cd98d2d588731ec05330e
|