簡體   English   中英

Django設置未知參數:TEMPLATE_DEBUG

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM