首页 > 代码库 > flask web开发日记

flask web开发日记

from flask import Flask,make_response,redirect,abort
app = Flask(__name__)

@app.route(/index1)
def index1():
    return make_response(<h1>Bad Request</h1>, 400)

@app.route(/index2)
def index2():
    return <h1>Bad Request</h1>, 400

@app.route(/index3)
def index3():
    return redirect(http://www.baidu.com)

@app.route(/index4) def index4(): return abort(404)
if __name__ == __main__: app.run(debug=True) 

 

flask web开发日记