Skip to main content

django-custom-storage PyPi license

PyPi status PyPi version PyPi python version PyPi downloads PyPi downloads PyPi downloads

GitHub GitHub release GitHub release

Test codecov.io pre-commit.ci status gitthub.com

Check Demo Project

  • Check the demo repo on GitHub

Requirements

  • Python 3.10+ supported.
  • Django 4.2+ supported.

Setup

  1. Install from pip:
pip install django-custom-storage
  1. Modify settings.py by adding the app to INSTALLED_APPS:
INSTALLED_APPS = [
    # ...
    "compressor",
    "custom_storage",
    # ...
]
  1. Configure storage in settings.py. The package ships sensible defaults and reads the project specifics from APP_CONFIG["custom_storage"]; call apply_storage_defaults at the end of the file so the STORAGES, 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.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-custom-storage 0.3.24
File Size Uploaded
django_custom_storage-0.3.24.tar.gz 42.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-custom-storage 0.3.24
File Interpreter ABI Platform
django_custom_storage-0.3.24-py3-none-any.whl Python 3 none any Details

Total release size: 115.1 kB

Release files / django_custom_storage-0.3.24.tar.gz

Download URL django_custom_storage-0.3.24.tar.gz
Size 42.0 kB
Tags Source
SHA-256 checksum
How to use checksums
797ef09c1d30085b859d8186123fecb7f27c6ea432716ca31e5cd1e4fb6baca9
BLAKE2b-256 checksum
How to use checksums
696bbe8c3b75675b4b90444c3730bc5e65bad73d5f7a2d608ad62f33f8ec50e3
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.24-py3-none-any.whl

Download URL django_custom_storage-0.3.24-py3-none-any.whl
Size 73.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe4c3f3430f7b528b1755910c23b40b8a8c6db769a5479150d8af578f4abb2de
BLAKE2b-256 checksum
How to use checksums
bc4e5f023bdcc172e6961d58692409566382cdbaa4508fdb79f1548732deecad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.3.36

2 release files

0.3.35

2 release files

0.3.34

2 release files

0.3.33

2 release files

0.3.32

2 release files

0.3.31

2 release files

0.3.30

2 release files

0.3.29

2 release files

0.3.28

2 release files

0.3.27

2 release files

0.3.26

2 release files

This release

0.3.24 This release

2 release files

0.3.19

2 release files

0.3.18

2 release files

0.3.17

2 release files

0.3.16

2 release files

0.3.15

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page