V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
tangyuan
V2EX  ›  Python

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

  •  
  •   tangyuan · 2013-02-08 00:00:16 +08:00 · 4538 次点击
    这是一个创建于 4112 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我按照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">

    但是启动服务器后央视完全没有出来...我又逐行对照了,没有问题呀...
    3 条回复    1970-01-01 08:00:00 +08:00
    ericFork
        1
    ericFork  
       2013-02-08 00:20:23 +08:00   ❤️ 1
    ……你把它当成 php 了吧……
    ritksm
        2
    ritksm  
       2013-02-08 00:22:32 +08:00   ❤️ 1
    tangyuan
        3
    tangyuan  
    OP
       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')
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5644 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:54 · PVG 15:54 · LAX 00:54 · JFK 03:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.