[Django]-Django app works fine, but getting a TEMPLATE_* warning message

88👍

✅

Set debug in OPTIONS dictionary of your templates settings.

DEBUG = True

TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'debug': DEBUG,
        },
    },
]

Then remove this line from your settings to stop the warnings

TEMPLATE_DEBUG = DEBUG

See the Django docs for detailed instructions how to update your template settings.

15👍

remove APP_DIRS and add the loaders inside the templates.
example:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        ,
        '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',
            ],
            'loaders': [
               'django_jinja.loaders.AppLoader',
                'django_jinja.loaders.FileSystemLoader',
            ]
        },
    },
]

14👍

From settings.py remove all this:

    TEMPLATE_DIRS = (
        os.path.join(BASE_DIR,  'templates'),
    )

Then add ‘templates’ here:

    TEMPLATES = [
    {
        ...
        'DIRS': [here],
        ...
            ],
        },
    },
]

8👍

This is the best solution:

Change this line to:

TEMPLATES[0]['OPTIONS']['debug'] = True

which should fix the warning.

I have found it here.

1👍

In my setting.py in django, there is not this script :

TEMPLATE_DEBUG = DEBUG

and

'debug': DEBUG,
'DEBUG': DEBUG,
'TEMPLATE_DEBUG': DEBUG

Maybe you can try to remove them and run it again.

Leave a comment