django.core.exceptions.ImproperlyConfigured: Enable 'django.contrib.auth.context_processors.auth'
Asked Answered
T

1

6

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

Trickery answered 26/1, 2016 at 1:33 Comment(2)
#6099830Homoiousian
#30005627Homoiousian
M
13

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",
            ]
        }
    }
]
Misanthrope answered 26/1, 2016 at 1:42 Comment(1)
Actually, it does. Here is the link to the section explaining that.Misanthrope

© 2022 - 2024 — McMap. All rights reserved.