I don't use django, but can you wrap the import statement with a try/catch
and print out additional debug information when it fires?

Things like the uwsgi environ or  and nginx or python environment variables
you can get.

On Thu, Jan 10, 2019 at 6:22 AM tk <tkad...@yandex.com> wrote:

>
>
> Le 10/01/2019 à 9:19 AM, Larry Martell a écrit :
>
> > I have both 1.9 and 2.0 and it happens with both.
>
> Django 1.9 is quite old and probably no longer supported. You should
> upgrade to Django 1.11.x for best results. I never tried seriously
> Django 2.0 yet. :-)
>
> tk
>
>
> >> Le 05/01/2019 à 4:01 PM, Larry Martell a écrit :
> >>> 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?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?
> >>> _______________________________________________
> >>> uWSGI mailing list
> >>> uWSGI@lists.unbit.it
> >>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
> >>>
> >>
> >> --
> >> tkad...@yandex.com | Twitter: @wise_project
> >> https://www.isotoperesearch.ca/
>
> --
> tkad...@yandex.com | Twitter: @wise_project
> https://www.isotoperesearch.ca/
> _______________________________________________
> uWSGI mailing list
> uWSGI@lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to