Home > Software design >  I am getting TemplateDoesNotExist error in Django version 4.0
I am getting TemplateDoesNotExist error in Django version 4.0

Time:12-19

urls file
from django.urls import path
from django.urls.resolvers import URLPattern
from . import views

urlpatterns = [
    path('hello/', views.say_hello),
    path('name/', views.name),
    path('tp/', views.tp)
]

#views file def tp(request): return render(request, 'TP.html')

CodePudding user response:

According to your file structure, you have your templates in a directory called Template.

However, Django by default looks for a directory named templates.

You can update the name of your Template folder OR

In your settings.py

TEMPLATE_DIRS = (
    os.path.join(SETTINGS_PATH, 'Template'),
)

CodePudding user response:

Change your Tempalte file name tempalte to Tempaltes

  • Related