1

in django3.2 I was trying this to uses for locating and loading templates? but doesn't work with me

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ` [BASE_DIR / 'templates']`,
    }

default setting was like :

`from pathlib import Path`

# Build paths inside the project like this: BASE_DIR / 'subdir'.

BASE_DIR = Path(__file__).resolve().parent.parent 

Any clue of what might be the problem?

Badr Ozgar
  • 31
  • 4

3 Answers3

0

try using

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
    }
Akash NO
  • 308
  • 3
  • 11
0

if you want to change your template path, you can using this in your settings.py, for example i have a "templates" directory for my templates in root of project:

    TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
    },
]
0

Try this edit in your Django settings.py

TEMPLATES_DIR=BASE_DIR / 'templates'(line-17)
'DIRS':[TEMPLATES_DIR,],(line-58)
Nicolò Gasparini
  • 2,228
  • 2
  • 24
  • 53