51Testing软件测试论坛
标题:
登陆功能编写
[打印本页]
作者:
luckystar121
时间:
2019-5-14 13:55
标题:
登陆功能编写
老师好:按照您的代码写好了,登陆网页报错如图:
3.png
(23.13 KB, 下载次数: 31)
下载附件
2019-5-14 13:54 上传
# -*- coding: utf-8 -*-from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash, _app_ctx_stackSECRET_KEY = 'development key'# create our little application
app = Flask(__name__)app.config.from_object(__name__)app.config.from_envvar('FLASKR_SETTINGS', silent=True)@app.route('/login', methods=['GET', 'POST'])def login(): error = None if request.method == 'POST': if request.form.get('username') !="12345": #if request.form['username'] != "12345": error = 'Invalid username' #elif request.form['password'] != "12345": elif request.form.get('password') !="12345": error = 'Invalid password' else: session['logged_in'] = True 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
作者:
学掌门网校
时间:
2019-5-14 13:57
login.html怎么写的 报了username 错误了 看下这个前端文件
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2