losee losee - 2 months ago 32
Git Question

Django app has a no ImportError: No module named 'django.core.context_processors'

Tried git pushing my app after tweaking it and got the following error.

ImportError: No module named 'django.core.context_processors'


this was not showing up in my heroku logs and my app works locally so I was confused. I had to set debug to true on the production side to finally figure this out. What can I do to clear this up?

this is some of the traceback

Request Method: GET
Request URL: http://hispanicheights.com/
Django Version: 1.10.1
Exception Type: ImportError
Exception Value:
No module named 'django.core.context_processors'
Exception Location: /app/.heroku/python/lib/python3.5/importlib/__init__.py in import_module, line 126
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.5.1
Python Path:['/app',
'/app/.heroku/python/bin',
'/app/.heroku/python/lib/python3.5/site-packages/setuptools-23.1.0-py3.5.egg',
'/app/.heroku/python/lib/python3.5/site-packages/pip-8.1.2-py3.5.egg',
'/app',
'/app/.heroku/python/lib/python35.zip',
'/app/.heroku/python/lib/python3.5',
'/app/.heroku/python/lib/python3.5/plat-linux',
'/app/.heroku/python/lib/python3.5/lib-dynload',
'/app/.heroku/python/lib/python3.5/site-packages',
'/app',
'/app']


I looked at line 126 and this is what's there

return _bootstrap._gcd_import(name[level:], package, level)


this

django.core.context_processors


is no where to be found in the init file. I looked in my settings file for production and saw this

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'debug': True,
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"django.core.context_processors.request",
],
},
},
]


am I supposed to modify this some how?

Answer

Try removing "django.core.context_processors.request" from your settings.

In Django 1.10 django.core.context_processors has been moved to django.template.context_processors. See the release notes

You already have the request context processors, no need to add it again with the wrong location.

Comments