标签:
@app.route(‘/login‘, methods=[‘GET‘, ‘POST‘])def login():if request.method == ‘POST‘:do_the_login()else:show_the_login_form()
url_for() 函数就是用于构建指定函数的 URL 的。
url_for()
.. print url_for(‘index‘).. print url_for(‘index‘)@app.route(‘/‘)def hello_world(): return ‘Hello World!‘ if __name__ == ‘__main__‘: app.run()
.. print url_for(‘index‘)
.. print url_for(‘index‘)@app.route(‘/‘)def hello_world(): return ‘Hello World!‘ if __name__ == ‘__main__‘: app.run()
重定向
redirect(url_for(‘login‘))
@app.errorhandler(404)def not_found(error):return render_template(‘error.html‘), 404
route()
bootstrap基本使用
原文地址:http://www.cnblogs.com/wuqingzangyue/p/5749959.html