About

Media library to upload and manage files (the WordPress Media Library analogue)

Provides

Models
MediaItem
Services
MediaService
Routes
/admin/media/admin/media/<int:item_id>/admin/media/<int:item_id>/crop/admin/media/<int:item_id>/delete/admin/media/<int:item_id>/gallery/admin/media/upload/media/media/file/<int:item_id>/media/page/<int:page>/static/uploads/<path:filename>
Hooks filled
home.sectionlayout.authenticated_sidebar
Translations
enes

Commands

  • $ splent feature:media hello

    Example command — replace with your own.

Run them in your workspace once the feature is installed in the selected product.

Configuration

Setting Default What it does
MEDIA_PUBLIC_GALLERY true Whether uploads are browsable by anyone or only by those who can edit.
MEDIA_NAV_LABEL empty Main-nav label for the gallery page. Empty keeps it out of the nav.
MEDIA_HOME_COUNT 0 Latest public photos shown on the homepage. Zero shows none. Also admin-editable in the settings panel, which wins.
MEDIA_GALLERY_VIEW grid Public gallery: default view (grid|mosaic), photos per scroll page, seconds per photo in the slideshow, and whether the upload form ticks "show in the public gallery" by default. All admin-editable, panel wins.
MEDIA_GALLERY_PAGE_SIZE 48 No description yet.
MEDIA_SLIDESHOW_SECONDS 4 No description yet.
MEDIA_UPLOAD_IN_GALLERY true No description yet.
MEDIA_MAX_UPLOAD_SIZE 100M Largest file the library accepts, as 100M, 1G or a number of bytes. 0 means no limit. It raises the framework's request cap, never lowers it, and MAX_CONTENT_LENGTH in the deployment's .env still wins.
PROTECTED_UPLOADS_DIR empty Where files that are not public live. Empty means the framework's default under the product directory. In production this is the mount target of a named volume, so it is set alongside that volume rather than here.
PROTECTED_FILES_ACCEL_PREFIX empty Internal redirect prefix for handing a protected file to nginx instead of streaming it through Python. Empty means stream it, which is correct without a proxy in front.

These are the defaults. A product changes them in its own pyproject.toml, under [tool.splent.config], or in .env.deploy in production.

Dependencies

Requires
Works better with

In product lines

Extension points

Templates
media/admin.htmlmedia/admin_detail.htmlmedia/gallery.htmlmedia/hooks/home_section.html
Services
MediaService
Models
MediaItem
Routes
A refinement can add routes to its blueprint

Other features fill its hook slots. A refinement can override its templates and services or extend its models without forking it.

Compatibility

Python
>=3.13
SPLENT framework
>=1.30.0
Python packages
Pillow>=10