【发布时间】:2011-10-03 21:24:53
【问题描述】:
我正在编辑文件:
/templates/account/base.html
并希望在其中包含:
/templates/profiles/includes/sub_nav.html
我尝试了以下方法:
{% block subnav %}{% include "profiles/includes/sub_nav.html"%}{% endblock %}
结果:没有错误但没有包含侧边栏
我也试过了
{% block subnav %}{% include "../profiles/includes/sub_nav.html"%}{% endblock %}
结果: 模板错误页面:异常值:渲染时捕获 TemplateDoesNotExist:../profiles/includes/sub_nav.html
突出显示以下行: {% 扩展 "account/base.html" %}
因此,对于下面,/templates/account/base.html 所包含的 XXX 应该是什么?
{% block subnav %}{% include "XXX/sub_nav.html"%}{% endblock %}
【问题讨论】:
标签: python django django-templates include-path