Flask之闪现
作者:互联网
闪现是基于session的 ,session是基于会话的,所以不同用户的请求不会搞混。
from flask import Flask,request,redirect,flash,get_flashed_messages
app = Flask(__name__)
app.secret_key="ddtegesgee"
@app.route('/index')
def index():
name = request.args.get("name")
if name == "kk":
return "index!"
else:
flash("%s error!"%(name))
# return "error"
return redirect("/error")
@app.route("/error")
def error():
msg = get_flashed_messages()
return "error,%s!"%(msg)
if __name__ == '__main__':
app.run()
标签:__,return,name,Flask,app,闪现,error 来源: https://blog.csdn.net/kanghui_898/article/details/100734160