16π
β
You need to tell Django what is the additional location of your template folder (projekt_folder/template
) which is not under installed apps, add following lines at top of your settings file:
import os
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
Then set DIRS
in TEMPLATES
setting var:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(PACKAGE_ROOT, 'template')],
'APP_DIRS': True,
'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',
],
},
},
]
π€Aamir Rind
0π
Django 3.1.5:
You need to tell Django template engine where to look for your base.html template by adding itβs path in the DIRS like this :
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# BASE_DIR in your case is '/projekt_folder'
'DIRS': [
BASE_DIR / 'template'
],
'APP_DIRS': True,
'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',
],
},
},]
π€Blanklob
Source:stackexchange.com