[Django]-Dynamically add to TEMPLATE_DIRS at runtime with a Django project


Write a template loader you can point at a theme directory instead.


I’ve done something like that, pls take a look here https://github.com/ASKBOT/askbot-devel/blob/master/askbot/skins/loaders.py

Besides the template loader you may need means to resolve media specific to your theme. It can be for example a template tag or a filter that takes some base url and adds theme prefix or something like that, also you could make that automatically keep track of media versions. That way that when you refresh .js or other file the client will have to load the latest version.



not sure if it’s the same issue as my question theme switching, template and css file layout on a django site

subdirs of templates can be set as context var which is used as parameter for extend template tag

Leave a comment