烧瓶在返回jsonify之前就挂了((没有输出错误))

时间:2018-11-10 01:24:31

标签: json ajax python-3.x flash flask-login

我是一名新开发人员,我制作了一个页面,用于检查用户是否已登录负载,是否由用户将登录表单替换为服务器中的其他数据

另一方面,如果未显示,则显示登录表单,并等待用户单击“登录”以触发另一个ajax来验证并提取用户信息并返回Json对象。

问题发生在返回行之前-我通过print追溯了问题并登录js,返回jsonify行之前一切正常

奇怪的部分是它永远不会挂起任何错误

 def clogin():

print(f"\n login activated \n")
if request.method == "POST":
    loginName = request.form.get("memberNameid")
    loginPw = request.form.get("passwordloginid")
    #session['user'] = loginName


    f = Users.query.filter_by(email=loginName).first()
    login_user(f)
    session['user'] = f
    print(f"I have receved this from AJAX ... \n \n loginName = {loginName} \n loginPw = {loginPw} \n current_user = {current_user} \n current_user.id = {current_user.id} \n current_user.name = {current_user}")
    print(f"f.email = {f.email} \n f.pw = {f.password}")

    if f:
        qdisplayname = f.name
        print("qdisplayname = ",qdisplayname)
        if f.email == loginName: #and sha256_crypt.verify(loginPw,f.qpw):
            if f.pos == "pos2":
                print("pos : pos 2 was picked ")

                return jsonify({"Success": True , "Msg":" lets try to get jinja to work - email {{ current_user.email }} " , "position" : "Pharmacist" , "displayname":current_user.name })

这是CMD输出:

登录已激活

我已经从AJAX收录了这个内容...

loginName = qwe@qwe.qwe
loginPw = qwe
current_user = <Users 1>
current_user.id = 1
current_user.name = <Users 1>
f.email = qwe@qwe.qwe
f.pw = qwe
qdisplayname =  name2
pos : pos 2 was picked

请让我知道您是否知道如何使烧瓶像这样悬挂? 我什至无法刷新或导航到其他页面,我必须关闭服务器

0 个答案:

没有答案