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