0

django can not find .html file and return TemplateDoesNotExist Error! See image below.

error image

Views.py

from django.shortcuts import render
from django.http import HttpResponse

def home(request):
    return render(request, 'blog/home.html')


def about(request):
    return HttpResponse('<h1>Blog About</h1>')

Urls.py

from django.urls import path
from . import views

urlpatterns = [
    path('', views.home, name='blog-home'),
    path('about/', views.about, name='blog-about'),]

Settings.py

In setting.py everything is default i only changed one thing in TEMPLATES[]"

'DIRS': [os.path.join(BASE_DIR, 'template')],

For more donwload codes rar file: https://drive.google.com/open?id=1zg5CN4IyqPtMMyvkru6fUYAQJcbmfX00

  • Does this answer your question? [Django TemplateDoesNotExist?](https://stackoverflow.com/questions/1926049/django-templatedoesnotexist) – Abijith Mg May 22 '20 at 06:26
  • Please show the layout of your files in the question, instead of asking users to download your project. – Alasdair May 22 '20 at 07:25

1 Answers1

0

I downloaded and ran the code. Just change the name of template to templates in settings.py and also change the directory name in blog app. It worked when I did the sameenter image description here

SAI SANTOSH CHIRAG
  • 2,046
  • 1
  • 10
  • 26