Please help. How do I Fix Template Does Not Exist error?

I am working on a tutorial from Real Python - “Build a Blog From Scratch With Django”. I have built the index.html, the detail.html and the category.html files. Without using the base.html my code displays properly in the browser. However when I extend the base.html in the index and detail files I get the error “TemplateDoesNotExist”

Following the instructions I have also added the root folder templates/ folder to the settings.py file.

I’m not clear on what the situation is here. Are you saying that this fixed it, or are you still having a problem?

If you’re still having a problem, did you create your base.html file in the templates folder?

What exactly do you have in your templates in the “extends” tag? (Show the actual extends tag that you are using in your other templates.)

Also post the TEMPLATES setting from your settings.py file.

1 Like

Hi Ken, I think I have got it.I slept over the code, thinking about the suggestions you made. I think the problem I have been having with the base.html file is that I have been creating the templates folder in the project and not the root directory. I went back to my code, created a templates folder in the root folder and voila my site is working. I first had this problem when I was working on a tutorial by Corey Schafer. Now when I finish this Real Python blog I will revisit the one by Corey Schafer. Thanks for your helping hand

Yippee!!! I have finished the tutorial. Thank you!! A very big thank you to @KenWhitesell, @philgyford, and @anefta. I believe if I had people like you when I was starting to learn C# and Unity Game Engine I would not have dropped C# and I would probably be playing my own games by now. Not to worry. I appreciate what you guys are doing for me. I will now go back to the tutorials by Corey Schafer and Dave Gray. I had the same problem of ‘TemplateDoesNotExist’. Now I know how to fix it. Thanks and see you guys again. There is so much to learn.

1 Like