请问在python bottle的模板中如何才能使用bootstrap呢?

2013-02-08 00:00:16 +08:00
 tangyuan
我按照bootstrap官方的最简单的范例将html代码照搬到了index.tpl模板中,完全是拷贝粘贴(当然css的引用路径进行了相应的调整)

/app.py
/views/
index.tpl
/bootstrap/
/css/
...
/img/
/js/


index.tpl
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="../bootstrap/css/bootstrap-responsive.css" rel="stylesheet">

但是启动服务器后央视完全没有出来...我又逐行对照了,没有问题呀...
4548 次点击
所在节点    Python
3 条回复
ericFork
2013-02-08 00:20:23 +08:00
……你把它当成 php 了吧……
ritksm
2013-02-08 00:22:32 +08:00
tangyuan
2013-02-08 00:24:28 +08:00
@ericFork ...

谢谢eric的提醒,看到文档中有提到要route,我马上去试下

from bottle import static_file
@route('/static/<filename>')
def server_static(filename):
return static_file(filename, root='/path/to/your/static/files')

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/60063

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX