模板路径配置.../templates目录,目录下有模板a.html和b.html,我这样用
//a.html中
{% include "b.html" %}
//报错,找不到模板 b.html
回复 (7)
W
可能要用绝对路径,遇到过类似问题,用绝对路径解决了。
M
relative include 已经支持了... include "./b.html"
M
btw use swig / swig-templates instead
T
前面加上./再试试
D
引用 tomoya92前面加上./再试试
Template render error: (unknown path)
Error: template not found: ./includes/ban-list.html
D
引用 magicdawnrelative include 已经支持了... include "./b.html"
@magicdawn 我可能哪里做的不对...没理由这个都不支持
C
在哪个目录下运行的服务器? 路径寻找是基于当前目录/模板目录/模板文件, 我的是这样的. server/server.js views/*.nunj server.js里面直接用的views而不是../views
参与回复
登录后即可参与回复。登录