Reputation: 5507
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
Upvotes: 2
Views: 2129
Reputation: 840
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...)
Upvotes: 6