Portable media infrastructure for Django.
Project description
WBR Media
Portable media infrastructure for Django.
wbr_media provides a clean, consistent way to store, manage, render, and now port media assets between Django installations without requiring a full CMS.
📷 Screenshots
Media Index
A lightweight media library view with previews and metadata.
Media Detail
Asset inspection with preview, metadata, and image properties.
Why WBR Media?
Django provides excellent support for uploading files, but it intentionally leaves higher-level media management to individual applications.
wbr_media fills that gap by providing:
- structured media storage
- automatic metadata extraction
- consistent template rendering
- safe file lifecycle management
- complete import/export portability
without introducing the complexity of a full content management system.
Why not just use Django FileField?
You certainly can—but most projects eventually end up rebuilding the same infrastructure:
- metadata extraction
- image dimension detection
- MIME type detection
- cleanup of replaced files
- cleanup of deleted files
- rendering helpers
- import/export tooling
wbr_media packages those capabilities into a small, reusable application.
✨ Features
- Structured
MediaAssetmodel - Automatic file metadata extraction
- Image-specific metadata (dimensions, format, alpha, DPI)
- Safe file replacement and deletion
- Flexible template rendering
- Media portability with checksum validation
- Complete export/import workflow for media libraries
📸 Rendering Media
Load the template tags:
{% load wbr_media_tags %}
Render using the default presentation:
{% render_media asset %}
Or customize the presentation:
{% render_media asset display="bare" class_name="card-image" %}
Optional Arguments
| Argument | Description |
|---|---|
size |
Named size (currently returns the original file) |
display |
figure (default for images), bare, or link (default for non-images) |
class_name |
CSS class applied to the rendered element |
🚀 Installation
pip install -e .
Add the application:
INSTALLED_APPS = [
...
"wbr_media",
]
Configure the upload location.
Note: The configured upload path is appended to Django's
MEDIA_ROOT.
WBR_MEDIA = {
"UPLOAD_TO": "wbr_media/%Y/%m/",
}
Run migrations:
python manage.py migrate
⚙️ Configuration
Available settings:
WBR_MEDIA = {
"UPLOAD_TO": "assets/originals/%Y/%m/",
}
📦 Media Portability
One of the primary goals of wbr_media is complete portability.
A media library consists of two distinct pieces:
- Media metadata stored in the database
- Physical media files stored on disk
wbr_media exports and restores both as a single portable bundle.
Exporting a Media Library
Create a complete export:
python manage.py export_wbr_media --output ./backups/wbr_media_export.zip
The export process:
- Exports all
MediaAssetandImageMetadatarecords. - Copies physical media assets.
- Generates a manifest describing every exported file.
- Calculates SHA-256 checksums for each asset.
- Validates the completed archive.
- Produces a portable bundle.
Bundle Layout
wbr_media_export.zip
├── data.json
└── media_export.zip
├── media_manifest.json
└── files/
The media manifest records:
- exported file path
- existence
- file size
- SHA-256 checksum
These checksums are verified before any restore operation proceeds.
Importing a Media Library
Restore a previously exported bundle:
python manage.py import_wbr_media ./backups/wbr_media_export.zip
The import process:
- Opens the bundle.
- Validates the manifest.
- Verifies SHA-256 checksums.
- Restores physical media assets.
- Restores media database records.
If validation fails, restoration is aborted before modifying the destination installation.
Low-Level Commands
The application also exposes lower-level commands for working directly with physical media.
Export physical assets:
python manage.py export_media_files --output ./exports/media
Inspect a media archive:
python manage.py inspect_media_import ./exports/media_export.zip
Restore physical assets:
python manage.py restore_media_files ./exports/media_export.zip
These commands are primarily intended for development, debugging, and testing. In most cases, export_wbr_media and import_wbr_media should be preferred.
🧪 Development
A demo project is included.
cd demo
python manage.py runserver
Visit:
http://127.0.0.1:8000/media-demo/
Testing
Run the complete test suite:
pytest
📦 What This Is
- A lightweight media layer for Django
- Consistent media metadata management
- Flexible template rendering
- Safe file lifecycle management
- Portable media transfer between installations
🚫 What This Is Not
- A CMS
- A digital asset management system
- A replacement for WordPress or Drupal
- A complete media workflow solution
wbr_media is intentionally focused on providing a clean infrastructure layer that can be integrated into larger Django applications.
🛣️ Roadmap
Future improvements include:
- Generated image renditions
- Pluggable storage backends
- Media usage tracking
- Project-specific rendering extensions
The project intentionally avoids becoming a full CMS.
📄 License
All Rights Reserved.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wbr_media-0.2.0.tar.gz.
File metadata
- Download URL: wbr_media-0.2.0.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc3a1c4bc878fc3229c135cd25d57fa21b653c34dce29d50d1f8d02279b099bc
|
|
| MD5 |
2715b96622f7252699e5b7a6969919d6
|
|
| BLAKE2b-256 |
5f92503c7fcc2dd82afa05ea072456cbb69533c2e4e1066b4e0ce5367ad22788
|
Provenance
The following attestation bundles were made for wbr_media-0.2.0.tar.gz:
Publisher:
publish.yaml on HolisticNetworkingNet/wbr_media
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wbr_media-0.2.0.tar.gz -
Subject digest:
cc3a1c4bc878fc3229c135cd25d57fa21b653c34dce29d50d1f8d02279b099bc - Sigstore transparency entry: 2048321048
- Sigstore integration time:
-
Permalink:
HolisticNetworkingNet/wbr_media@b4973203cf4f2629a0e8a64e5c0f0a33d78d037e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/HolisticNetworkingNet
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@b4973203cf4f2629a0e8a64e5c0f0a33d78d037e -
Trigger Event:
release
-
Statement type:
File details
Details for the file wbr_media-0.2.0-py3-none-any.whl.
File metadata
- Download URL: wbr_media-0.2.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
529704950a7224edb644a04b85769635b5d20a4a9d81e6111b8dcb5a5b4b8bbf
|
|
| MD5 |
c7b2376d1691ec7aadfe83a6d90c83d3
|
|
| BLAKE2b-256 |
6647ebdc2f242dfa563e2fe6f396d5d691aa1b3c428574b1754014d243bf9ba1
|
Provenance
The following attestation bundles were made for wbr_media-0.2.0-py3-none-any.whl:
Publisher:
publish.yaml on HolisticNetworkingNet/wbr_media
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wbr_media-0.2.0-py3-none-any.whl -
Subject digest:
529704950a7224edb644a04b85769635b5d20a4a9d81e6111b8dcb5a5b4b8bbf - Sigstore transparency entry: 2048321064
- Sigstore integration time:
-
Permalink:
HolisticNetworkingNet/wbr_media@b4973203cf4f2629a0e8a64e5c0f0a33d78d037e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/HolisticNetworkingNet
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@b4973203cf4f2629a0e8a64e5c0f0a33d78d037e -
Trigger Event:
release
-
Statement type: