Flask登录-使用Firebase

问题描述 投票:0回答:1

以下内容使我登录,但由于某处存在错误,因此继续使我返回登录屏幕。但是,这使我感到困惑,因为它确实使我登录。

我该如何调试它,以便在控制台的输出上得到更具体的答案(找到为什么不通过的实际错误。如果这是问题?)>

“ GET / login HTTP / 1.1” 200-

“ GET /static/main.css HTTP / 1.1” 404-

@app.route("/result", methods = ["POST", "GET"])
def result():
if request.method == "POST":        #Only if data has been posted
    result = request.form           #Get the data
    email = result["email"]
    password = result["pass"]
    try:
        #Try signing in the user with the given information
        user = auth.sign_in_with_email_and_password(email, password)
        #Insert the user data in the global person
        global person
        person["is_logged_in"] = True
        person["email"] = user["email"]
        person["uid"] = user["localId"]
        #Get the name of the user
        data = db.child("users").get()
        person["name"] = data.val()[person["uid"]]["name"]
        #Redirect to welcome page
        return redirect(url_for('dashboard'))
    except:
        #If there is any error, redirect back to login
        return redirect(url_for('login'))
else:
    if person["is_logged_in"] == True:
        return redirect(url_for('dashboard'))
    else:
        return redirect(url_for('login'))

我是行业的数据科学家,但不熟悉烧瓶。.预先感谢。

以下内容使我登录,但由于某处存在错误,因此继续使我返回登录屏幕。但是,这使我感到困惑,因为它确实使我登录。如何调试它以获得更具体的答案(...

flask-login
1个回答
0
投票

heroku上有一个“查看日志”页面,您可以在部署期间和导航部署时查看该页面。

如果在命令提示符之外,则非常有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.