作者gn00618777 (非常念旧)
看板Python
标题[问题] template 问题
时间Thu Feb 12 16:52:23 2015
我在 A 资料夹有 a.html a1.html a2.html,a.html内容是
<li class="link">
<a target="main" href="net_interfaces.html">
Network Interfaces
</a>
</li>
我在 templates 资料夹 有个 b.html,这个html 在我的 python 主程式
是会被 return render_template('b.html', **templateData)
而a.html在 python 主程式中是直接被 return send_from_directory('xx/xx/A','a.html')
我想将 a.html 中的 net_interfaces.html 改成 templates 资料夹中的 html
会找不到URL,输入完整路径也无法。只能选择同在 A 资料夹中的 a1.html or a2.html
请问要怎麽修改让我能存取到 templates 资料夹中的 html?
ps 不是直接用 render_template('b.html',**templateData)
而是希望用 send_from_directory('','a.html'),并且透过a.html内的超连结
存取到 template 里的 html 。谢谢。 想了一天了~"~
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.251.223.31
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1423731146.A.087.html
1F:→ uranusjr: 『透过a.html内的超连结存取到 template 里的 html』 02/12 23:27
2F:→ uranusjr: 这件事无法直接用 Flask 办到, 请乖乖写 view 02/12 23:27
3F:→ gn00618777: 好的,谢谢。 02/14 20:02