According to Django documentation
"Your project's TEMPLATES setting describes how Django will load and render templates. The default settings file configures a DjangoTemplates backend whose APP_DIRS option is set to True. By convention DjangoTemplates looks for a “templates” subdirectory in each of the INSTALLED_APPS."
My Mezzanine settings.py has this configuration
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',
],
},
},
]
My directory structure is
project
app_name
templates
app_name
index.html
But the template loader stops at
project
app_name
templates
As such my app_name template index.html is not reached. What can be the problem?
然后,您可以使用'app_name / index.html'访问模板
Did you try to change your template dirs on setting.py
like this
'DIRS': ["templates"],
and did your views.py
provide specific location of template Eg
return render(request, 'foldername/templatename.html', {})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.