python - Django 1.8 ignores DIRS, cannot find templates -
here templates section in settings.py:
templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [ os.path.join(base_dir, 'templates'), ], 'app_dirs': true, 'options': { 'context_processors': [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', ], }, }, ]
i'm using template inside application directory , works. whenever i'm trying extend layout global templates directory (os.path.join(base_dir, 'templates'), exists, tested), django raises templatedoesnotexist error. here template-loader postmortem, not includes dirs directory:
django tried loading these templates, in order: using loader django.template.loaders.filesystem.loader: using loader django.template.loaders.app_directories.loader: /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/layouts/default.html (file not exist) /usr/local/lib/python2.7/dist-packages/django/contrib/auth/templates/layouts/default.html (file not exist) /home/foundation/public/foundation/foundation/event_request/templates/layouts/default.html (file not exist)
**update: ** seems apache loads django 1.5 instead of django 1.8. might problem.
after log entry
using loader django.template.loaders.filesystem.loader:
loader should print possible locations tried find template, after similar log app_directories
loader. if there no paths here, double check if templates
setting defined correctly, not overwritten somewhere later in settings or other files , if django loading settings file correctly.
you can throw exception 500 server error when debug
set true
, on error page handy list of settings django sees.
also check if wsgi server loading proper version of django, older versions doesn't have template
setting (it splitted between multiple settings).
Comments
Post a Comment