【发布时间】:2012-06-13 12:28:13
【问题描述】:
我正在使用 Flask 0.8。
如何拥有这样的 URL 别名:
@app.route('/')
def index():
# I want to display as http://localhost/index, BUT, I DON'T WANT TO REDIRECT.
# KEEP URL with only '/'
@app.route('/index')
def index():
# Real processing to display /index view
那么,为什么我希望使用别名,因为处理 /index 的 DRY
有人知道解决方案吗?
感谢胡椒粉。
【问题讨论】:
标签: python flask jinja2 werkzeug