Skip to main content

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

  1. Install the package with:

    pip install django-media-placeholder

  2. Uninstall the package with:

    pip uninstall django-media-placeholder

  3. Add and URL to your URLCONF:

    from django_media_placeholder.static import static
    urlpatterns = [
        ...
    ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    
  4. 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'
    
  5. 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'
    

Metadata

Release files for django-media-placeholder 0.1

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-media-placeholder 0.1
File Size Uploaded Provenance Actions
django_media_placeholder-0.1.tar.gz 3.3 kB Without provenance Details for django_media_placeholder-0.1.tar.gz

Release files / django_media_placeholder-0.1.tar.gz

Download URL django_media_placeholder-0.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
60f975601cb6a7e6985e252efed6ce9336a15978ae765d39c46d5362f4c7dc53
BLAKE2b-256 checksum
How to use checksums
268e3b4a1438ca02f122f2726c6c5b741ed0e69d15bc4ed99afe7290ac3f4350
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for django-media-placeholder 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

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