Python全栈之Flask 简介( 三 )

 
WC_public_flask.py
from flask importFlask, render_template, requestapp = Flask(__name__, template_folder='templates')@app.route('/')def login():   return render_template('login.html')@app.route('/login',methods = ['POST', 'GET'])def loginok():   if request.method== 'POST':      user = request.form['nm']      return render_template('loginok.html',name =user)   else:      user = request.args.get('nm')      return render_template('loginok.html',name =user)if __name__ == '__main__':   app.run(debug = True)



推荐阅读