推荐学习书目
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
cctvnews
V2EX  ›  Python

bottle view 视图不能调用模板文件

  •  
  •   cctvnews · Jan 21, 2019 · 2024 views
    This topic created in 2673 days ago, the information mentioned may be changed or developed.
    from bottle import route,run
    from bottle import template,view

    @route('/')
    def index():
    var ="123.com"
    return template('index',text=var)

    @route('/kvm')
    @view('kvm')
    def kvm():
    var = "123.com"
    return var

    两个模板内容完全一样

    访问时根目录使用模板可以正常显示,/kvm 路由无法显示模板内容,只能显示 var 内容
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3126 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:02 · PVG 21:02 · LAX 06:02 · JFK 09:02
    ♥ Do have faith in what you're doing.