bootstrap是封装了css和js代码实现酷炫的效果,所以使用的时候,比如说是列表效果,直接调用它本身定义的函数就ok了
静态文件
把href=\'..static/..\'里面改为url_for静态文件路径
url_for(\'static\', filename=\'style.css\')
@app.route(\'/login\', methods=[\'GET\', \'POST\'])def login():if request.method == \'POST\':do_the_login()else:show_the_login_form()
url_for() 函数就是用于构建指定函数的 URL 的。
.. 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() 装饰器来告诉 Flask 触发函数的 URL 。