Examples
2018.4.2 flask web

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)

posted on 2018-04-03 10:18  先行一步  阅读(126)  评论(0编辑  收藏  举报
Examples