H.G.
H.G.

Reputation: 399

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.

Upvotes: 3

Views: 8725

Answers (2)

mottaz hejaze
mottaz hejaze

Reputation: 1240

context_processors in Django 1.10 and above has been moved from core to template.

Replace

django.core.context_processors

with

django.template.context_processors

Upvotes: 5

Siva Arunachalam
Siva Arunachalam

Reputation: 7740

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

Upvotes: 10

Related Questions