How to change the template path dynamically in Django 1.8 -
i want add mobile version site, need change template path dynamically mobile template dir or desktop dir. as template_dirs deprecated since version 1.8, tried change dirs option of djangotemplates backend, didn't work. as had same challenge post code here. using get_flavor django_mobile detect show , wanted use standard admin directories (as installed) django_admin_bootstrapped , regular django admin. in addition wanted interfere loader admin pages , not regular pages - in latter case loader nothing. so works me: import os.path django.template.loaders.base import loader django.template.loader import loaderorigin django.template import templatedoesnotexist django_mobile import get_flavour class myloader(loader): is_usable = true #this line necessary make work def load_template_source(self, template_name, template_dirs=none): path_split = template_name.split("/") if not u'admin' in path_split: raise ...