2018.4.2 flask web

时间:2022-11-30 20:44:27

from flask import Flask,request

from flask import jsonify

from flask import render_template

app = Flask(__name__)

@app.route("/")

def base():

return render_template("signin.html")

@app.route('/signin', methods=['POST'])

def signin():

if request.form['username']=='wj' and request.form['password']=='123321':

return render_template("index.html")

return render_template("bad.html")

@app.route("/hello", methods=['GET', ])

def hello():

return jsonify(msg="hello world!")

if __name__ == '__main__':

app.run(host='0.0.0.0',port=5000,threaded=True)