利用flask写出基本逻辑----------------------------------------------
from flask import Flask,render_template,request,session,redirect,url_for,flash,jsonify
import aaa
app = Flask(name)
app.secret_key = ‘1810’
@app.route(’/’,methods=[‘GET’,‘POST’])
def login():
if request.method == ‘POST’:
username = request.form.get(‘username’)
password = request.form.get(‘password’)
if password == ''or username == ‘’:
flash(‘不能为空’)
else:
users = aaa.get1(
‘select * from customer where username = “{}” and password="{}"’.format(username,
password))
if len(users) > 0:
session[‘username’] = username
print(‘登录成功’)
return redirect(url_for(‘goods’))
else:
flash(‘登录失败!!!’)
return render_template('Login.html')
@app.route(’/goods’,