当我尝试向“http://{{MY IP}}:5000/alldocuments”发送 GET 请求时,出现错误。我正在关注 youtube 视频教程,甚至来自 github 的直接示例也不起作用。所有其他路线都有效,但我无法使这条路线有效。我无法在 SQLAlchemy 的文档中找到我的答案,但也许我只是想念它。我不知道出了什么问题?我正在传递带有附加数据的结果对象。我在 youtube 上关注这个视频:https://www.youtube.com/watch ?v=PTZiDnuC86g这是包含教程中完整代码的 github: https: //github.com/bradtraversy/flask_sqlalchemy_rest我收到此错误:<!--Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/app.py", line 2309, in __call__ return self.wsgi_app(environ, start_response) File "/usr/lib/python3/dist-packages/flask/app.py", line 2295, in wsgi_app response = self.handle_exception(e) File "/home/pi/.local/lib/python3.7/site-packages/flask_restful/__init__.py", line 272, in error_router return original_handler(e) File "/usr/lib/python3/dist-packages/flask/app.py", line 1741, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/pi/.local/lib/python3.7/site-packages/flask_restful/__init__.py", line 272, in error_router return original_handler(e) File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/pi/GotangoDocs/Backend/server.py", line 76, in get_documents return jsonify(result.data)AttributeError: 'list' object has no attribute 'data'-->
添加回答
举报
0/150
提交
取消