set up templates path in django settings code example
Example 1: dirs' base_dir / 'templates' error
Incorrect syntax in polls app tutorial by Django
Use this:
os.path.join(BASE_DIR, 'templates')
instead of this:
BASE_DIR / 'templates'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
],
},
},
]
Example 2: make new app folder in django templates dir
TEMPLATES = [
{
...
'DIRS': [os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'templates', 'the_folder_you_created'),
...
]
}
]