Skip to content
Advertisement

Template file not found Django

I am trying to make a home page of a new website via Django. My app name is ‘blog’, home page is home.html I still receive the error template does not exist when I go to http://127.0.0.1:8000/blog/home/

I made sure I added ‘blog’ to my templates in settings.py and that I added the folder templates in the main directory as well as through blog/templates/blog/home.html

myproject/blog/views.py

JavaScript

myproject/blog/urls.py

JavaScript

myproject/settings.py

JavaScript

myproject/urls.py

JavaScript

Do you see anything in my code which causes a problem? I receive the message in blog/views.py that “Template file ‘blog’ not found” on the line

return render(request, ‘blog/home.html’)

Advertisement

Answer

You are doing it wrong. You need to read the Django documentation carefully and try to understand whatever you read and implement the same step by step. The url you have to hit is

JavaScript

home.html will be rendered at this url. You don’t put html page name in the url

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement