当前位置:   article > 正文

【sqlalchemy 错误 AttributeError】_attributeerror: type object 'user' has no attribut

attributeerror: type object 'user' has no attribute 'query

sqlalchemy查询错误AttributeError: type object 'User' has no attribute 'query'

错误提示

AttributeError
AttributeError: type object ‘User’ has no attribute ‘query’

Traceback (most recent call last)
File “D:\py\asset-manager\venv\lib\site-packages\flask\app.py”, line 2095, in call
return self.wsgi_app(environ, start_response)
File “D:\py\asset-manager\venv\lib\site-packages\flask\app.py”, line 2080, in wsgi_app
response = self.handle_exception(e)
File “D:\py\asset-manager\venv\lib\site-packages\flask\app.py”, line 2077, in wsgi_app
response = self.full_dispatch_request()
File “D:\py\asset-manager\venv\lib\site-packages\flask\app.py”, line 1525, in full_dispatch_request
rv = self.handle_user_exception(e)
File “D:\py\asset-manager\venv\lib\site-packages\flask\app.py”, line 1523, in full_dispatch_request
rv = self.dispatch_request()Open an interactive python shell in this frame
File “D:\py\asset-manager\venv\lib\site-packages\flask\app.py”, line 1509, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File “D:\py\asset-manager\pc_manager\permissions\user.py”, line 17, in test
user = User.query.filter_by(username=‘admin’).first()
AttributeError: type object ‘User’ has no attribute ‘query’

如下图
在这里插入图片描述

问题查找及解决如下图:

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/253783
推荐阅读
相关标签
  

闽ICP备14008679号