Skip to main content

A small reusable media app for Django projects

Project description

from demo.demo.settings import WBR_MEDIA

wbr_media

Python Django Status Tests

A small, reusable media app for Django.

wbr_media provides a clean way to store, manage, and render media assets without pulling in a full CMS or rebuilding the same patterns in every project.


📷 Screenshots

Media Index

A lightweight media library view with previews and metadata. Media index

Media Detail

Asset inspection with preview, metadata, and image properties. Media detail


Why WBR Media?

Django handles file uploads well, but it doesn’t provide a consistent, structured way to manage and render media across content types.

wbr_media is a small layer that standardizes:

  • how media is stored
  • how metadata is handled
  • how media is rendered in templates

without introducing a full CMS.

Why not just use Django FileField directly?

You can—but you'll end up reimplementing:

  • metadata extraction
  • file cleanup on replacement
  • consistent rendering patterns
  • image-specific handling

wbr_media provides these in a small, reusable layer.

✨ Features

  • Structured MediaAsset model
  • Automatic file metadata extraction (name, size, MIME type)
  • Image-specific metadata (dimensions, format, etc.)
  • Safe file replacement and deletion (no orphaned files)
  • Simple, flexible template tag for rendering media

📸 Example

{% load wbr_media_tags %}

{% render_media asset %}
{% render_media asset display="bare" class_name="card-image" %}

🚀 Installation

pip install -e .

Add to your Django settings:

INSTALLED_APPS = [
    ...
    "wbr_media",
]

Configure your media save location.

IMPORTANT: This directory will be appended to the MEDIA_ROOT setting.

WBR_MEDIA = [
    "UPLOAD_TO": "wbr_media/%Y/%m/",
]

Run migrations:

python manage.py migrate

🧠 Basic Usage

Upload media via Django admin, then render in templates:

{% load wbr_media_tags %}

{% render_media asset %}

Optional arguments

{% render_media asset size="full" %}
{% render_media asset display="bare" %}
{% render_media asset class_name="my-class" %}

Arguments

Argument Description
size Named size (default: "full" — currently original file)
display Controls markup:
figure (default for images)
bare (just <img>)
link (default for non-images)
class_name Passed through to the rendered element

⚙️ Configuration

Optional settings:

WBR_MEDIA = {
    "UPLOAD_TO": "assets/originals/%Y/%m/",
}

📦 What This Is

  • A lightweight media layer for Django projects
  • A consistent way to handle files + metadata
  • A simple rendering interface for templates

🚫 What This Is Not

  • Not a CMS
  • Not a full media library UI
  • Not trying to replicate WordPress

This is a focused, infrastructure-level tool.


🧪 Development

A demo project is included:

cd demo
python manage.py runserver

Testing

pytest 

Visit:

http://127.0.0.1:8000/media-demo/


🛣️ Roadmap

Small, practical improvements:

  • Size-based image renditions
  • Better integration with project-specific design systems
  • Optional media usage tracking

No large UI or CMS features are planned.


📷 Screenshots (optional)

Add a screenshot of:

  • Admin media preview
  • Demo grid page

📄 License

All Rights Reserved.

Project details


Download files

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

Source Distribution

wbr_media-0.1.2.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wbr_media-0.1.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file wbr_media-0.1.2.tar.gz.

File metadata

  • Download URL: wbr_media-0.1.2.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wbr_media-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9d29c33dd4dc693274efb49bc98600727ff9691b97de8629e1056762a9f988dc
MD5 ffaed3cee6afbe533663a61ec3d297a0
BLAKE2b-256 37f51690a37a2318a5fdbac0dab76a7f970aa394cda6f6970eeb78af4f522970

See more details on using hashes here.

Provenance

The following attestation bundles were made for wbr_media-0.1.2.tar.gz:

Publisher: publish.yaml on HolisticNetworkingNet/wbr_media

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wbr_media-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: wbr_media-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wbr_media-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 73e1ed416fe0a14945d28a6af0650929a5b770029007a1d330f67db414f8f238
MD5 af4b8ad7a9b4d23d8913d56d867957a6
BLAKE2b-256 5673dc7ee542533e8573eb512713a36e393c8bdffdff8bfa71909741f34ac4dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for wbr_media-0.1.2-py3-none-any.whl:

Publisher: publish.yaml on HolisticNetworkingNet/wbr_media

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page