Can't locate template, super new user here!

I am a super new user to Django (Python as well). I have been trying out this (https://youtu.be/br0819-OFg4) tutorial and on part three I am not getting the same result at time- 9:15. I am getting an error: https://www.ppaste.org/GghTtaPqV. I am also attaching my project structure if it helps. I would really appreciate some guidance.

The error message is saying that it can’t find base.html.

Your directory image isn’t showing a base.html.

Where is your base.html file, and what is your ‘TEMPLATES’ setting in your settings.py file?

Sorry for not showing it in the project structure, it was in the tutorial > templates folder. I have posted another screenshot.

My base.html has these lines:

{% extends ‘base.html’ %}

{% block content %}

<h1>Hello World!</h1>

{% endblock content %}

Is progproj in your list of installed applications?

reviews is the app and I have added that on the installed apps list in settings as ‘reviews’,.

Your base.html is not in your ‘reviews’ app, it’s in the progproj app.

Your template settings specifies APP_DIRS: True, but the progproj app isn’t in your list of installed apps. You also don’t have any directories specified in the DIRS section of your TEMPLATES. So what has happened here is that you haven’t told Django where to find base.html.

You can:

  • add progproj to your list of installed apps,
  • specify the progproj directory in the DIRS section,
  • move your progproj/templates directory up a level and specify it in the DIRS section of your TEMPLATES configuration,
    or
  • move base.html into reviews/templates/reviews.

The progproj is the main project folder I believe, there is only one app (reviews). This is may be a very silly question, can you please tell me what exactly should I put in the Templates in settings.py? Thanks.

You can choose from any of the four options I listed in my previous reply. Each one of those options is going to require that you take different steps to implement them.

What you would choose as “the best” choice from among those four options is going to depend a lot upon a number of different factors. Probably the most significant one is that you’re working from a video tutorial.

Quite honestly, I lack the desire or inclination to try and watch a video to figure out if or how your project setup differs from the video, to find out what you would need to do to get back on track.

I will direct you to the settings documentation for the TEMPLATES setting, in particular the DIRS setting and the APP_DIRS setting, so that you can get a better understanding of these options and how they’re used.

I think you just need to add your project templates directory to the TEMPLATES variable, DIRS in the settings.py.

like this:

'DIRS': [ BASE_DIR / 'demoproject/templates'],