简体   繁体   中英

Django settings Unknown parameters: TEMPLATE_DEBUG

Hi I'm following the tutorial on the djangoproject site and I'm getting an error on my localhost saying:

Unknown parameters: TEMPLATE_DEBUG

My settings.py looks like this:

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',
            ],
        },
    },
]

I added the 'TEMPLATE_DEBUG' on TEMPLATE because otherwise I'm getting the following warning

?: (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 templates folder are in my apps ie:

my_project_name/polls/templates/polls/index.html

I think you need to do:

DEBUG = True 

TEMPLATES = [
    {
        # something else
        'OPTIONS': {
            'debug': DEBUG,
        },
    },
]

Django used to accept TEMPLATE_DEBUG variable but since Django >= 1.8 , this not allowed any more and is replaced as explained above.

Django doc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM