Complete the code to add the templates directory path in Django settings.
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [[1]],
'APP_DIRS': True,
}]The DIRS list should include the path to your templates folder, usually 'templates/'.
Complete the code to enable Django to find templates inside app directories.
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': [1],
}]Setting APP_DIRS to True tells Django to look for templates inside each app's templates folder.
Fix the error in the template directory path to use an absolute path.
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATES = [{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, [1])], 'APP_DIRS': True, }]
Use 'templates' without a trailing slash inside os.path.join to correctly build the absolute path.
Fill both blanks to configure Django to load templates from a custom directory and app directories.
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATES = [{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, [1])], 'APP_DIRS': [2], }]
Set DIRS to your custom folder name and APP_DIRS to True to load templates from both places.
Fill all three blanks to correctly set up template directories and enable app templates in Django settings.
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATES = [{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, [1])], 'APP_DIRS': [2], 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', [3] ], }, }]
Use 'templates' for the directory, set APP_DIRS to True, and include the auth context processor for user info in templates.