Djandoを始めたばかりで、templateを使い始めたのですが、django.template.exceptions.TemplateDoesNotExist: home.html
というエラーが発生しました。
views.py
from django.shortcuts import render
from django.http import HttpResponse
from .models import ToDoList, Item
def index(response, id):
ls = ToDoList.objects.get(id=id)
return render(response, "main/base.html", {"name":ls.name})
def home(response):
return render(response, "main/home.html", {'name':'test'})
base.html
<html> <head> <title>Website</title> </head> <body> <p>{{name}}</p> </body> </html>home.html
{% extends 'main/base.html' %}
htmlのファイルは、どちらもアプリ内の、templateというファイルの中にあります。
設定のtemplateガ関係しているかと思い、setting.py を見てみましたが、何が欠けているのか分かりません
setting.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',
],
},
},
]
アドバイスいただけたら嬉しいです。
お願いいたします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。