I’m going to guess that you’re trying to include navbar.html
within index.html
where you have {% block navbar %}{% endblock %}
? If I’m wrong you can ignore the rest of this 
In Django templates, if you want to do that you should:
- In
index.html
replace {% block navbar %}{% endblock %}
with {% include "navbar.html" %}
- Remove
{% extends 'index.html' %}
, {% block navbar %}
and {% endblock %}
from navbar.html
- Remove the
NavbarView()
from HowTo_views.py
- that view isn’t being used, as far as I can tell.
That should mean that when you view the URL /
the HomePageView()
will be called, rendering the index.html
template. This will include the navbar.html
template in the correct position.
However… this is fine for one page, but when you add others, that need different templates, then you’re going to either duplicate all of the boilerplate HTML (like <head>
etc) in index.html
in the other templates, or else move that boilerplate into “include” files and include them in the new templates.
It would be best to try to get your head around extending templates, which is what was happening with the base.html
and home.html
from the tutorial you were doing. It’s sort of the inverse of “including” files, which can make it hard to understand when it’s a new concept to you.
The idea is to have a base.html
template which contains all of the common bits of your site’s HTML: <head>
etc, but also often things like navbars, headers, footers, etc. The template doesn’t have to be called base.html
, but that’s the convention.
Within that base template you have “blocks” which are like slots into which other templates – that extend from base.html
– insert their own content.
So your base.html
might have {% block main %}{% endblock %}
tags where the main content of each page would go.
Then a view will render a template for its page. Such as home.html
. This would look something like:
{% extends "base.html" %}
{% block main %}
<p>This is the main content of my page</p>
{% endblock %}
So that’s indicating which base template it’s extending. Because you could have different base templates – for example if you had different overall layouts or designs for different parts of your site.
And then it has the HTML that goes into the “main” slot in that base.html
template.
You can have lots of blocks in a base template.
And non-base templates can also contain blocks if other templates extend from them.
And you can still {% include ... %}
other partial templates.
But this way of extending a base template is a good way to structure things, and is used in nearly all Django projects, so it’s worth persevering with.