本文介绍了django.core.exceptions.ImproperlyConfigured:启用'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.
我跟随Django文档1.9:
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
推荐答案
您需要将其添加到 选项
:
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",
]
}
}
]
这篇关于django.core.exceptions.ImproperlyConfigured:启用'django.contrib.auth.context_processors.auth'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!