routes.py
@app.route('/signin', methods=['GET','POST'])
def sign():
form=forms.Signin()
return render_template('signin',form=form)
if request.method=='POST':
fname=str(request.form['firstname'])
lname=str(request.form['lastname'])
uname=str(request.form['username'])
btype=str(request.form['businesstype'])
em=str(request.form['email'])
passw=str(request.form['password'])
repass=str(request.form['repassword'])
sess=sessionmaker(bind=engine)
sign=sess()
signer=User(firstname=fname,lastname=lname,username=uname,businessType=btype,email=em,password=passw,repassword=repass)
sign.add(signer)
sign.commit()
flash("Signed in. You can now log in")
return home()
elif request.method=='GET':
return home()
上面的代码从登录页面中选择数据。但是,它不会使用数据更新我的数据库。我不知道哪里出错了。请帮助