如何解决Firestore get() 在 Flask 中不获取数据
我无法从生产服务器上的 Firebase Cloud Firestore 获取数据。我有以下代码:
@app.route('/forgot-password',methods=['GET','POST'])
def forgotpassword():
if 'email' in session:
return redirect(url_for('profile'))
form = ForgotPasswordForm()
if form.validate_on_submit():
try:
user_ref = db.collection(u'users').document(form.email.data)
user = user_ref.get()
except Exception as e:
print(e)
if user.exists:
try:
auth.send_password_reset_email(form.email.data)
print(form.email.data)
flash('A link to reset your password has been sent to your mail.','success')
except Exception as e:
print(e)
flash('There was an error while sending the email.','danger')
else:
print("not registerd")
flash('This email is not registered.','danger')
print(form.errors)
return render_template('forgotPasswordPage.html',form=form)
我没有得到任何异常输出,因为似乎没有抛出任何异常。相同的代码适用于我的本地主机,但不适用于生产服务器。
db.collection(u'users').document(form.email.data)
成功返回了一个 firestore 文档对象,但 get()
函数是导致问题的原因。可能是什么问题?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。