So I have upgraded an old project from Django 1.6 to 1.10, and now all templatse from a specific directory are no longer loading.
the location of these templates are in
/project/templates/userena
these templates should be overriding the templates included with the userena library in
/usr/local/bin/python2.7/dist-packages/userena
I have read the Django documentation for template loading but it does not make sense to me at all.
Currently my settings.py has this
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': False,
'OPTIONS': {
'debug': DEBUG,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
],
},
},
]
What do I need to change in my settings.py in order to have Django load templates from /project/templates/userena?
Django uses the template loaders in order according to the 'loaders' option. It uses each loader until a loader finds a match. (docs).
So, yes, ordering matters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With