Welcome! Log In Create A New Profile

Advanced

Re: intermittent No module named context_processors when using nginx/uwsgi

Robert Paprocki
January 05, 2019 04:26PM
Given that the stack trace is from Python, it’s not an nginx configuration issue. Are you reverse proxying from nginx multiple uwsgi backgrounds that have different configuration?

Sent from my iPhone

> On Jan 5, 2019, at 13:01, Larry Martell <larry.martell@gmail.com> wrote:
>
> I am having an odd interment django problem. I have an app which is
> deployed at 30 different sites, some with apache and wsgi and some
> with nginx and uwsgi. At only the nginx/uwsgi sites and only
> intermittently, users will get the error No module named
> context_processors.
>
> I am only posting it here because the issue only occurs when using
> nginx/uwsgi and never with apache/wsgi. I have posted this to both the
> Django group and stackoverflow, but had not received any help.
>
> 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.
>
> 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?
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

intermittent No module named context_processors when using nginx/uwsgi

Larry Martell January 05, 2019 04:02PM

Re: intermittent No module named context_processors when using nginx/uwsgi

Robert Paprocki January 05, 2019 04:26PM

Re: intermittent No module named context_processors when using nginx/uwsgi

Larry Martell January 05, 2019 05:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 119
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready