Ilya Bibik
Ilya Bibik

Reputation: 4124

Including template that is located outside of the main folder

In my main template folder I have 2 folders explorer and includes

template 
  explorer
     body.html
  includes
     header.html

I want to include in my body.html file header.html from includes folder

tried those options :

{% include "../includes/header.html" with active_tab='dashboard' %}
{% include "/includes/header.html" with active_tab='dashboard' %}

in both options - can not find the path

What is the correct way of doing it?

Upvotes: 0

Views: 28

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599610

Django template paths are always absolute, from the root of the template folder (or whatever folder is included in the TEMPLATE dirs setting.) So it's just {% include 'includes/header.html' %}.

Upvotes: 1

Related Questions