Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django.core.exceptions.ImproperlyConfigured: Enable 'django.contrib.auth.context_processors.auth'

I started a new project and am getting:

django.core.exceptions.ImproperlyConfigured: Enable 'django.contrib.auth.context_processors.auth' in your TEMPLATES setting in order to use the admin application.

I followed the django docs for 1.9:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
    }
]

What could be the issue (how does it want me configure)? Thank you

like image 337
codyc4321 Avatar asked Jan 26 '16 01:01

codyc4321


1 Answers

You need to add it into context_processors list in the OPTIONS:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                "django.contrib.auth.context_processors.auth",
            ]
        }
    }
]
like image 110
Ozgur Vatansever Avatar answered Sep 20 '22 23:09

Ozgur Vatansever