Django include can not find template

I am trying to include 'comment.html' into store.html and store.html extend base.html.

But Django is throwing error comment.html (<class 'django.template.base.TemplateDoesNotExist'>)

All templates are in the same Dir. store.html works fine and it is extending base.html properly without any problem.But when i included comment.html in store.html the error is thrown... I have used {% include "comment.html" %} this to include comment.html into store.html

Dir tree where these files are located: vaibhav@ubuntu:~/TRAC/bright-coupons/brightCoupons/brightCouponsApp$ tree .

├── __init__.py
├── models.py
├── templates
│   ├── about.html
│   ├── base.html
│   ├── comment.html
│   ├── contact.html
│   ├── error.html
│   ├── index.html
│   ├── index-var.html
│   ├── store.html
│   ├── stores.html
│   ├── submit-form.php
│   ├── support.html
│   └── tags.html
├── tests.py
├── views.py

Answers


Note that when you do include to you have to put the path relative to the root of the template dir. So if comment.html resides in TEMPLATE_BASE_DIR/app/comments.html you have to do

{% include "app/comments.html" %}

the paths is not relative to the location of the including template (since the including template could be a string for that matter...)


Need Your Help

At what point should NLP processing occur?

database data artificial-intelligence nlp statistics

In a perfect world, I'd have a bunch of data readily available to me without any time spent asking for and receiving it. But in the context of real applications, like google or facebook, you have a

Are there any cases where it is incorrect to replace push_back with emplace_back?

c++ vector

Can I break a valid C++03 program by replacing std::vector::push_back with emplace_back and compiling it with C++ 11 compiler? From reading emplace_back reference I gather it shouldn't happen, but ...