@app.route("/login",methods=["POST","GET"])
def login():
if request.method == 'POST':
session.pop('user_id',none)
userrnam = request.form.get("username")
palavrapass= request.form.get("password")
usere = users.query.filter_by(username=userrnam).first()
if usere and palavrapass == usere.password:
session.['User_id'] = usere.id
return redirect(url_for('profile'))
pass
return render_template("login.html")
When I run the program, it tells me that this line of code
session.['User_id'] = usere.id
is invalid syntax. If this is wrong syntax, than which is the correct way?
目前没有回答
相关问题 更多 >
编程相关推荐