Process every media request, if media not present locally, and try to obtain in another location
Project description
Django Media Placeholder
This project override django static media
and storage
(optional), for process every media request, if media not present locally, and try to obtain in another location
Its great for dev, homolog and QA ambients because no need to copy production media every time.
Installation
-
Install the package with:
pip install django-media-placeholder
-
Uninstall the package with:
pip uninstall django-media-placeholder
-
Add and URL to your URLCONF:
from django_media_placeholder.static import static urlpatterns = [ ... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
-
On
settings.py
, setMEDIA_URL
to point to it... STATIC_URL = '/static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(DATA_DIR, 'media') STATIC_ROOT = os.path.join(DATA_DIR, 'static') ALTERNATIVE_MEDIA_URL = 'Url to Get image not present in locally'
-
If use thumbanails, set
DEFAULT_FILE_STORAGE
to new storage, (thumbnails's libs generate and get image directly in disk, no request to media path):DEFAULT_FILE_STORAGE = 'django_media_placeholder.custom_storage.OverwritingStorage'
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
File details
Details for the file django_media_placeholder-0.1.tar.gz
.
File metadata
- Download URL: django_media_placeholder-0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60f975601cb6a7e6985e252efed6ce9336a15978ae765d39c46d5362f4c7dc53 |
|
MD5 | 6471ab76ea795fd07ffd66023eec6c3c |
|
BLAKE2b-256 | 268e3b4a1438ca02f122f2726c6c5b741ed0e69d15bc4ed99afe7290ac3f4350 |