V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Feb 8, 2013 · 5135 views
    This topic created in 4827 days ago, the information mentioned may be changed or developed.
    我按照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 replies    1970-01-01 08:00:00 +08:00
    ericFork
        1
    ericFork  
       Feb 8, 2013   ❤️ 1
    ……你把它当成 php 了吧……
    ritksm
        2
    ritksm  
       Feb 8, 2013   ❤️ 1
    tangyuan
        3
    tangyuan  
    OP
       Feb 8, 2013
    @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')
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5833 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 01:50 · PVG 09:50 · LAX 18:50 · JFK 21:50
    ♥ Do have faith in what you're doing.