1. 程式人生 > >請求及重定向

請求及重定向

def 重定向 true out for color deb Coding turn

#coding=utf-8
from flask import Flask
from flask import request
from flask import redirect


app = Flask(__name__)


@app.route("/home")
def hello_world():
    return "hello world"

@app.route("/user", methods=["GET", "POST"])
def check_user():
    if request.method == "GET":
        
return "Please register first!" if request.method == "POST": user = request.form.get("user") return redirect("/home") if __name__ == __main__: app.run(debug=True)

請求及重定向