Answer the question
In order to leave comments, you need to log in
Why does not see templates?
Structure:
settings.py:
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',
],
},
},
]
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('home/', include('home.urls')),
]
from django.urls import path
from home import views
urlpatterns = [
path('', views.index, name='index'),
]
views.py
from django.shortcuts import render
def index(request):
return render(request, 'home/index.html')
Answer the question
In order to leave comments, you need to log in
Tell Django to start looking for templates in the templates folder
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, '..' , 'templates'),],
'APP_DIRS': True,
Something like this
https://docs.djangoproject.com/en/dev/ref/settings...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question