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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_custom_storage-0.3.6.tar.gz (40.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_custom_storage-0.3.6-py3-none-any.whl (72.1 kB view details)

Uploaded Python 3

File details

Details for the file django_custom_storage-0.3.6.tar.gz.

File metadata

  • Download URL: django_custom_storage-0.3.6.tar.gz
  • Upload date:
  • Size: 40.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_custom_storage-0.3.6.tar.gz
Algorithm Hash digest
SHA256 51f697b77b02062b0f7d5b019fcf48cd6e0da72776dd43f26011ed4993e65987
MD5 206fe7050da9311b43535c3355f59f9f
BLAKE2b-256 6009d288f13e2a1983b620f46f83e2d2c8441ae9923531a919afd4a40a10f114

See more details on using hashes here.

File details

Details for the file django_custom_storage-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for django_custom_storage-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 dc25823d5e9e1b8c83bcaa02d7e4741c2c9fc585163fbf2f74888d6e14974e7e
MD5 299945141bc11b66d358c0b97f4d036b
BLAKE2b-256 e2696b0a3385a1f8b3b4de8ef21088ecd85829c0e537823570d8d3be5feec788

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.15

2 files

0.3.14

2 files

0.3.13

2 files

0.3.12

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

This release

0.3.6 This release

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page