|
老师,我不知道哪写的不对,麻烦帮忙看下
代码贴在下面了
from flask import Flask,request,session,g,redirect,url_for,abort,\ render_template,flashapp = Flask(__name__)app.config.from_object(__name__)app.config.from_envvar('FLASK SETTINGS',silent=True)@app.route('/login',methods=['GET','POST'])def login(): error = None if request.method == 'POST': if request.form['username']!='12345': error = 'Invalid username' elif request.form['password']!='12345': error = 'Invalid password' else: return redirect(url_for('login_ok')) return render_template('login.html',error=error)@app.route('/login_ok',methods=['GET','POST'])def login_ok(): return render_template('login_ok.html')@app.route('/logout')def logout(): session.pop('logged_in',None) return render_template('login_out.html')if __name__=='__main__': app.run()
在学课程
接口自动化测试平台测试开发
http://www.atstudy.com/course/1018
|
|