How to have nested base.html in django's templates?

Viewed 2340

I am rebuilding all my templates so it becomes a lot more manageable and custom, the tree would look like this :

├───core
│   └───templates
│       └───base.html (original, touches every page)
│   ...   
│
├───app1
│   └───templates
│       ├───base.html (extends from core/base.html, only touches app1)
│       └───file1.html (extends from app1/base.html)
│   ...
│
└───app2
    └───templates
        ├───base.html (extends from core/base.html, only touches app2)
        └───file2.html (extends from app2/base.html)
    ...

To connect app1's template to core's I use {% extends '../../core/templates/base.html' %}, in the core app there'll be {% block container %}{% endblock %} as example and in app1, app2 there'll be other {% block other_content %}{% endblock %} blocks. as you can see blocks are nested too.

The issue is that I get this error :

The relative path ''../../core/templates/base.html'' points outside the file hierarchy that template 'base.html' is in.

Question: I was wondering what was the best approach to resolve this issue without hardcoding it?

1 Answers
Related