Python Django设置未知参数:模板\u调试
您好,我正在按照上的教程进行操作,但我的本地主机上出现了一个错误,错误是:Python Django设置未知参数:模板\u调试,python,django,django-1.9,Python,Django,Django 1.9,您好,我正在按照上的教程进行操作,但我的本地主机上出现了一个错误,错误是: Unknown parameters: TEMPLATE_DEBUG My settings.py如下所示: TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'TEMPLATE_DE
Unknown parameters: TEMPLATE_DEBUG
My settings.py如下所示:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'TEMPLATE_DEBUG':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',
],
},
},
]
我在模板上添加了“TEMPLATE\u DEBUG”,因为否则我会收到以下警告
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.
我的模板文件夹位于我的应用程序中,即:
my_project_name/polls/templates/polls/index.html
我认为你需要做:
DEBUG = True
TEMPLATES = [
{
# something else
'OPTIONS': {
'debug': DEBUG,
},
},
]
Django用于接受TEMPLATE_DEBUG变量,但由于Django>=1.8,因此不再允许使用该变量,并按照上述说明进行替换
Django.好的,我现在就知道了
如果它将TEMPLATE\u DEBUG设置为与DEBUG不同的值,请将该值包含在“选项”中的“DEBUG”键下。
谢谢!