return render(request, template_name, {'form': form}) 我得到的错误 if not user.check_password(password):
AttributeError: 'NoneType' object has no attribute 'check_password'
这是一个我的aap.py文件,如果我提供了一个未注册的电子邮件和密码,那么他们也可以去/login页面。在"if user.check_password(form.password.data) and user is not None:“这一行抛出错误:”如有帮助,我们将不胜感激。 @app.route('/login', methods=['GET', 'POST']) form = LoginForm()
user
因此,当我在没有任何数据的情况下提交表单时,我将得到正确的this fields are required错误消息,但是当我只输入一个字段oldpassword并提交表单时,我将得到以下错误 if not self.user.check_password(self.cleaned_data.get("oldpassword")):
AttributeError: 'NoneType' object has no attribute
apply_driver_hacks11:58:18 web.1 | AttributeError: 'NoneType' object has no attribute 'drivername'
从我在网上找到的信息来看,问题似乎是我可能没有正确地连接到数据库。flask_sqlalchemy/__init__.py", line 7