Tknoobs
Tknoobs

Reputation: 169

django {% inlcude %} throws Template Error

The problem: I have a file base.html, where I have a {% block content %}, for the page's content and a {% inlcude %}, for the navigation bar (bootstrap) of the base template. But the include does not find the Template (TemplateDoesNotExist) and I am sure I didn't spell it wrong. Do I have to provide anything for the template to be found or what?

base.html important content:

<body>
    {% include "navbar.html" %}

    <div>
        {% block content %}
        {% endblock %}
    </div>
</body>

Some important information: I downloaded bootstrap in the base.html file; base.html and navbar.html are in the same folder.

enter image description here

Upvotes: 0

Views: 44

Answers (1)

Since in your directory structure, you have home directory inside templates. Please change code as per below :

<body>
    {% include "home/navbar.html" %}

    <div>
        {% block content %}
        {% endblock %}
    </div>
</body>

Upvotes: 2

Related Questions