1👍
You should include the os.path.join(...)
in the Template ‘DIRS’
Example:
In settings.py
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, 'templates')],
'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',
],
},
},
]
Then in your folder structure, you should have
app_name (main app folder) --> templates --> app_name(again) --> templates go here.
EDIT: I forgot to mention that in order to do this you must import os
0👍
treid change TEMPLATE_DIRS completly with this
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]
- [Answered ]-Serve static files from Cloudflare's R2
- [Answered ]-Django auto complete light says field is required on ForeignKey
Source:stackexchange.com