views
from flask import *
from DB import User
LoginView = Blueprint('LoginView', __name__)
@LoginView.route('/login', methods=['POST', 'GET'])
def bb():
if request.method == 'POST':
username = request.form['user']
password = request.form['pwd']
if User.query.filter(User.username == username, User.password == password).count() >= 1:
return render_template('index.html')
else:
return jsonify({'code': '400', 'msg': '登录失败,账号或密码错误!'})
else:
return render_template('login.html')
templates