我想包括评论.html“进入存储.html以及存储.html延伸基本.html. 在
但是Django抛出错误comment.html (<class 'django.template.base.TemplateDoesNotExist'>)
所有模板都在同一个目录中。store.html
工作正常,并且它没有任何错误地正确地扩展{store.html
中包含comment.html
时,会抛出错误。。。
我使用了{% include "comment.html" %}
这将comment.html
包含到store.html
中
这些文件所在的目录树: 瓦布哈夫@ubuntu:~/TRAC/bright coupons/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
请注意,当您确实包含到时,您必须将路径相对于模板目录的根目录。所以如果评论.html驻留在模板_BASE_DIR/app中/评论.html你必须这么做
路径与包含模板的位置无关(因为包含模板可能是字符串…)
相关问题 更多 >
编程相关推荐