Friday, December 9, 2016

Intermittent 'template not found' errors

I have an app that is deployed at 15 sites and has been running for 6
years. All these deployments are with django 1.5, python 2.6, CentOS6,
and apache, and they all work perfectly. I just deployed the app at a
new site, but this one is django 1.9, python 2.7, CentOS7, and
nginx/uwsgi. Only at this site we are seeing intermittent 'template
not found' errors. A refresh of the page always works. It happens with
different templates, and there are no errors in any of the logs
(except for the template not found error). I've checked the system
logs, the nginx logs, the uwsgi logs and the django logs.

Anyone know why this would be happening, and/or how I can debug it further?

One thing I noticed, and this may be normal, but I don't know as I've
never encountered this error before, is that in the template not found
error when it lists the directories it searched, they all are in /tmp.
The template it is searching for does exist at
/usr/local/motor/motor/app/cdsem/templates/WaferToWafer/view.html but
it's looking in /tmp/app/cdsem/templates/WaferToWafer/view.html

Is that any indication of a problem?

This is the error I get:

TemplateDoesNotExist at /report/CDSEM/WaferToWafer/

WaferToWafer/view.html

This is the template search:

Template-loader postmortem

Django tried loading these templates, in this order:

Using engine django:

django.template.loaders.filesystem.Loader:
/usr/local/motor/motor/ui/templates/WaferToWafer/view.html (Source
does not exist)
django.template.loaders.app_directories.Loader:
/usr/lib/python2.7/site-packages/django/contrib/admin/templates/WaferToWafer/view.html
(Source does not exist)
django.template.loaders.app_directories.Loader:
/usr/lib/python2.7/site-packages/django/contrib/auth/templates/WaferToWafer/view.html
(Source does not exist)
django.template.loaders.app_directories.Loader:
/tmp/core/alerts/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/core/reports/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/app/cdsem/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/app/semvision/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/app/developer/templates/WaferToWafer/view.html (Source does not
exist)
django.template.loaders.app_directories.Loader:
/tmp/ui/templates/WaferToWafer/view.html (Source does not exist)
django.template.loaders.app_directories.Loader:
/tmp/configuration/templates/WaferToWafer/view.html (Source does not
exist)

And here is my TEMPLATES from settings:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'motor/ui/templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'context_processors.config',
'ui.context_processors.navigation',
'core.appmngr.context_processor',
],
},
},
]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY53sdqjWzKR5Hn6F_7Lsw1yPDuqJ6aw%3D223b766Zshqeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment