Back slashes in TEMPLATES settings

DIRS must be forward slashes, even in Windows. Forward slashes do not need escaping, and they are cross Operating System compatible.

The TEMPLATE setting is a list of the template engines used when finding template files and rendering them.

The DIRS key within the TEMPLATE list denotes the directories where the engine should look for template source files.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

django-doctorbotsuggested changes just now
settings.py
1
+
TEMPLATES = [
2
+
    {
3
+
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
4
+
        'DIRS': ['\home\app\core\html'],
5
+
    },
6
+
]

DIRS must be forward slashes, even in Windows. Forward slashes do not need escaping, and they are cross Operating System compatible.

Read more
Update settings.py
We're your Django code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code template-dir-backslash in your pyproject.toml file.

Read more about configuring Code Review Doctor.