Ошибка
TemplateDoesNotExist at /
mysite/index.html
Request Method: GET
Request URL:
localhost:8000
Django Version: 2.1.5
Exception Type: TemplateDoesNotExist
Exception Value:
mysite/index.html
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.app_directories.Loader: Python\Python38-32\lib\site-packages\django\contrib\admin\templates\mysite\index.html (Source does not exist)
django.template.loaders.app_directories.Loader: \Python\Python38-32\lib\site-packages\django\contrib\auth\templates\mysite\index.html (Source does not exist)
django.template.loaders.app_directories.Loader: django_test\mysite\blog\templates\mysite\index.html (Source does not exist)
urls.py
from django.contrib import admin
from django.urls import path, include
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.index),
path('blog/', include('blog.urls', namespace='blog'))
]
views.py
from django.shortcuts import render
def index(request):
return render(request, 'mysite/index.html')
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',
],
},
},
]
Почему ошибка?
Путь mysite/index.html находится в папке templates