python模板是什么意思_python – 这个模板中的正确包含路径是什么?

我正在编辑文件:

/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:../ profile /includes / sub_nav.html

突出显示以下行:

{%extends“account / base.html”%}

因此,对于下面的内容,XXX应该包含在/templates/account/base.html中?

{% block subnav %}{% include "XXX/sub_nav.html"%}{% endblock %}

解决方法:

“结果:没有错误,但没有包含侧栏”.

逻辑结论

你的sub_nav.html有问题.或者你的base.html有问题包含正在运行.它必须是HTML,CSS或Django标签.

标签:python,django,django-templates,include-path

来源: https://codeday.me/bug/20190710/1419077.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值