Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Automatic generates images with the right dimensions whenit's missing from the local media storage based on a commondatabase or remote MEDIA_URL.

Project Description

Django Images Placeholder

Automatic generates images with the right dimensions when
it's missing from the local media storage using metadata of
a common database to generate a image or fetching from an
alternative MEDIA_URL.


1. Install the package with:

`pip install django-images-placeholder`

2. Uninstall the package with:

`pip uninstall django-images-placeholder`

3. Add "django_images_placeholder" to your INSTALLED_APPS setting like this::

4. Add and URL to your URLCONF:
# This is NOT meant to be used in production environment.
if settings.DEBUG:
from django_images_placeholder.views import serve_image_placeholder
urlpatterns = [
url(r'^media/', serve_image_placeholder, name='images_placeholder'),
] + urlpatterns

5. On ``, 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')
DEFAULT_FILE_STORAGE = 'django_images_placeholder.custom_storage.OverwritingStorage'

6. Optionally, set `ALTERNATIVE_MEDIA_URL` to point to a production MEDIA_URL,
so with the view fail to provide an image by openning it locally or trying
to generating it by original image reference' metadata, it you ultimatelly
try to fetch `ALTERNATIVE_MEDIA_URL` and cache it:


Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(4.7 kB) Copy SHA256 Hash SHA256
Source None Mar 13, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers