[英]Django settings Unknown parameters: TEMPLATE_DEBUG
嗨,我正在关注djangoproject网站上的教程,我在localhost上收到错误说:
Unknown parameters: TEMPLATE_DEBUG
我的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上添加了'TEMPLATE_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 doc 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.