Template Does Not Exist at home.html

Hello Django Forums, I am working on django for beginners and the code provided does not work. I have copied and pasted after manually typing it in and the error persists around this class based view. It claims that home.html does not exist. It certainly does. There is an odd home = value in the code that I do not understand why it is there as it is outside the norm. However I clearly see the hashtag # new which means to include the new code. I tried the extra removing home= and a red squiggly line immediately appeared as an error.

Another problem I am experiencing is that I went to a prior commit and github is saying hey, you need to do a pull request on the most recent branch. But it has the errors. Its the custom user model that I am operating from. I want to delete the other branches. Commit id: 9dfe63d

Any advice?

Traceback (most recent call last):
  File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/core/handlers/base.py", line 220, in _get_response
    response = response.render()
  File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/response.py", line 114, in render
    self.content = self.rendered_content
  File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/response.py", line 90, in rendered_content
    template = self.resolve_template(self.template_name)
  File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/response.py", line 72, in resolve_template
    return select_template(template, using=self.using)
  File "/Users/andrewstribling/Library/Python/3.9/lib/python/site-packages/django/template/loader.py", line 47, in select_template
    raise TemplateDoesNotExist(", ".join(template_name_list), chain=chain)

Exception Type: TemplateDoesNotExist at /
Exception Value: home.html

In django_project > urls.py

    path("", TemplateView.as_view(template_name="home.html"), 
    path("", include("pages.urls")), 

and this one in pages > urls.py

urlpatterns = [
    path("", HomePageView.as_view(), name="home"), 

This does not make sense, from root urls conf you can remove this line

path("", TemplateView.as_view(template_name="home.html"), name="home"),

Also in settings you have to update the login, logout redirect url because home is the name for HomePageView but the real url path is ‘/’.




From the book itself

But the thing is you have included pages.urls and it already have the url path to execute HomePageView.

And this path is also doing the same thing so it is not really needed.