Extension Media File Management


Extension Basics

Title
Media File Management
Name
ckanext-media
Type
Public extension
Description
Centralized media file management system
CKAN versions

~2.9, ~2.10, ~2.11

Show details
Download-Url (zip)
Download-Url commit date
2024-08-01
Url to repo
Category
Cloud Infrastructure & Storage


Background Infos

Description (long)
Show details

Flexible and centralized system for managing various media files (images, documents, custom file types) using CKAN’s core logic. Provides reusable solution for handling media assets across different parts of CKAN site. Store and manage media files with custom MIME type restrictions, define multiple media types (Image, File, Banner, etc.), use CKAN’s existing upload infrastructure (similar to user/group image uploads). Easily reference media using media IDs, keys, or filenames via helper functions: h.get_media_fileurl_by_id(), h.get_media_fileurl_by_key(), h.get_media_fileurl_by_filename(). Centralized control through Media UI eliminates code modifications for updating assets like banners or backgrounds. Storage path: ckan.storage_path + media folder.

Version
0.0.1
Version release date
2024-08-01
Contact name
Yan Rudenko
Contakt email
Contact Url
(not set)


Installation Guide

Configuration hints

Installation:

1. Activate CKAN virtual environment:

. /usr/lib/ckan/default/bin/activate

2. Clone and install:

git clone https://github.com/Datashades/ckanext-media.git

cd ckanext-media

pip install -e .

3. Add ‘media’ to ckan.plugins in config file

4. Initialize database:

ckan -c CKAN_CONFIG_PATH db upgrade -p media

5. Restart CKAN

#

Features:

- Store/manage media files with custom MIME type restrictions

- Define multiple media types (Image, File, Banner, etc.)

- Use CKAN’s existing upload infrastructure

- Reference media via ID, key, or filename

- Centralized control through Media UI

- Optional fine-grained MIME type restrictions per type

#

Use Cases:

- Upload/manage homepage banners, backgrounds, UI graphics

- Store shared documents not tied to specific dataset/org

- Reference uploaded media across templates

#

Template Helper Functions:

- h.get_media_fileurl_by_id(“1”)

- h.get_media_fileurl_by_key(“my_custom_key”)

- h.get_media_fileurl_by_filename(“FILENAME”)

#

Storage:

Main path: ckan.storage_path config + media folder

#

Documentation:

https://datashades.github.io/ckanext-media/

#

Works well with:

- ckanext-content: For media in custom content types

Plugins to configure (ckan.ini)
media
CKAN Settings (ckan.ini)
(not set)
DB migration to be executed
media
<< back to Extensions