Wednesday, January 2, 2019

No module named context_processors

I am having an odd interment problem. I have an app which is deployed
at 30 different sites. At one site only, and only intermittently, user
will get the error 'No module named context_processors'.

It may happen on a page that was previously accessed with no error and
upon refreshing the same page it will come up fine. It will not occur
for months, then happen a few times in one day.

The app is deployed with nginx and uwsgi.

Here is a typical traceback:

Internal Server Error: /
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py",
line 35, in inner
response = get_response(request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py",
line 158, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py",
line 156, in _get_response
response = response.render()
File "/usr/local/lib/python3.5/dist-packages/django/template/response.py",
line 106, in render
self.content = self.rendered_content
File "/usr/local/lib/python3.5/dist-packages/django/template/response.py",
line 83, in rendered_content
content = template.render(context, self._request)
File "/usr/local/lib/python3.5/dist-packages/django/template/backends/django.py",
line 61, in render
return self.template.render(context)
File "/usr/local/lib/python3.5/dist-packages/django/template/base.py",
line 173, in render
with context.bind_template(self):
File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.5/dist-packages/django/template/context.py",
line 246, in bind_template
processors = (template.engine.template_context_processors +
File "/usr/local/lib/python3.5/dist-packages/django/utils/functional.py",
line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.5/dist-packages/django/template/engine.py",
line 85, in template_context_processors
return tuple(import_string(path) for path in context_processors)
File "/usr/local/lib/python3.5/dist-packages/django/template/engine.py",
line 85, in <genexpr>
return tuple(import_string(path) for path in context_processors)
File "/usr/local/lib/python3.5/dist-packages/django/utils/module_loading.py",
line 17, in import_string
module = import_module(module_path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'ui.context_processors'

That file does exist and is readable:

-rw-rw-r-- 1 ubuntu ubuntu 1059 May 2 2018 ui/context_processors.py

And here is my TEMPLATES setting:

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'ui/templates'),
os.path.join(BASE_DIR, 'app/dse/templates'),
os.path.join(BASE_DIR, 'core/reports/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',
],
},
},
]

As I said it's intermittent. Anyone have any ideas on what it could be
and/or how to debug it?

--
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/CACwCsY6djuwtvwpq3d0entJWGWUyb3RU-gHM_eaQbwkbNxZSqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment