Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 i.e.:

my_project_name/polls/templates/polls/index.html
like image 301
Papouche Guinslyzinho Avatar asked Dec 15 '15 20:12

Papouche Guinslyzinho


1 Answers

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.

like image 74
Shang Wang Avatar answered Sep 23 '22 03:09

Shang Wang