Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
django-media-placeholder
Advanced tools
Process every media request, if media not present locally, and try to obtain in another location
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.
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
, set MEDIA_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'
FAQs
Process every media request, if media not present locally, and try to obtain in another location
We found that django-media-placeholder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.