[ckan-dev] How to add a folder with images to a CKAN plugin

Jesús Redondo redondogarciajesus at gmail.com
Tue Nov 25 12:44:10 UTC 2014


Hello,

I would like to know how to include a folder and its subdirectories to a
CKAN extension to be served as static content. This folders would include
the images for the plugin. For example:











*public   |   |- - Main_Images {some images}   |            |
|            |- Banners {some images}   |   |   |- - Apps
{images}           |           |- App1 {images about app1}*


So if my portal URL is http://portal.com I would like to access the images
in such fashion:





*http://portal.com/Main_Images/image1.png
<http://portal.com/Main_Images/image1.png>http://portal.com/Main_Images/Banners/banner1.png
<http://portal.com/Main_Images/Banners/banner1.png>http://portal.com/Apps/logo_apps1.png
<http://portal.com/Apps/logo_apps1.png>http://portal.com/Apps/App1/imageapp1.png
<http://portal.com/Apps/App1/imageapp1.png>... (and so on)*

I have tried with a public folder by modifying plugin.py:

 p.toolkit.add_public_directory(config, 'public')

Unfortunately, this only includes that specific folder, but not the
sub-folders (and it's too messy having all the images in the same path).

Thanks for the help,

Jesús Redondo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20141125/e279a99c/attachment-0002.html>


More information about the ckan-dev mailing list