您好,我正在学习 djangoproject site 上的教程我在本地主机上收到一条错误消息:
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 .
关于python - Django 设置未知参数 : TEMPLATE_DEBUG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34298867/