def do_login(request): try: if request.method == 'POST': backform = BackForm(request.POST) if backform.is_valid(): username = backform.cleaned_data['email'] password = backform.cleaned_data['password'] user = authenticate(email=username,password=password) print user if user: user.backend = 'users.auth.customBackend'# 指定自定义的登录验证方式 auth_login(request, user) return render(request,'common/index.html',locals()) else: return render(request,'common/error.html',{'error':'user is None'}) else: render(request,'common/error.html',{'error':'backform is not valid'}) else: render(request,'common/error.html',{'error':'request.method is not POST'}) except Exception as e: logger.error(e) return render(request,'common/error.html',{'error':'e'})
居然返回了最后一段代码
return render(request,'common/error.html',{'error':'e'})
不应该啊
请问哪里出错了?
确实在返回了error.html页面,只不过是没跳转而已,需要用pdb进行调试