I believe it is a configuration in the file settings.py
of the project.
Check if you have the TEMPLATES variable, like this:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['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',
],
},
},
]
Important:
'DIRS': ['templates']
: Define the name of the folders where Django will look for the templates, in your case, is templates.
'APP_DIRS': True
: Tells you if Django should look for templates within the applications, in your case it’s True.
By doing this setup it will find templates inside the 'templates' folder inside your application.
Something else:
If your structure is:
myapp
templates
myapp
index.html
The path of your template is not index.html
and yes myapp/index.html
I hope it helps you.
Hug.
Beto, didn’t you put the most important in your question... how are you calling this template? Because in its first folder structure just call
myapp/index.html
that everything would be OK...– fernandosavio