H.G. H.G. - 4 months ago 205
Python Question

ImportError: No module named context_processors

I am running the command in my django project:-

$python manage.py runserver


then I am getting the error like:-

from django.core.context_processors import csrf
ImportError: No module named context_processors


here is results of

$ pip freeze

dj-database-url==0.4.1
dj-static==0.0.6
Django==1.10
django-toolbelt==0.0.1
gunicorn==19.6.0
pkg-resources==0.0.0
psycopg2==2.6.2
static3==0.7.0


and

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]


I searched for many answers on stackoverflow but not getting the error.

Answer

The csrf module is moved from django.core.context_processors to django.views.decorators in the latest release. You can refer it here