我遇到这个奇怪的错误,当我尝试将MongoDebugPanel添加到我的Flask DebugToolbar扩展中时,这让我有点疯狂:
Traceback (most recent call last):
File "D:/Personal Backups/CodingProjects/HTML_Projects/MongoEngine/app.py", line 17, in <module>
toolbar = DebugToolbarExtension(app)
File "D:\Python\Anaconda3\lib\site-packages\flask_debugtoolbar\__init__.py", line 58, in __init__
self.init_app(app)
File "D:\Python\Anaconda3\lib\site-packages\flask_debugtoolbar\__init__.py", line 72, in init_app
DebugToolbar.load_panels(app)
File "D:\Python\Anaconda3\lib\site-packages\flask_debugtoolbar\toolbar.py", line 50, in load_panels
for panel_class in cls._iter_panels(app):
File "D:\Python\Anaconda3\lib\site-packages\flask_debugtoolbar\toolbar.py", line 57, in _iter_panels
panel_class = cls._import_panel(app, panel_path)
File "D:\Python\Anaconda3\lib\site-packages\flask_debugtoolbar\toolbar.py", line 71, in _import_panel
panel_class = import_string(path)
File "D:\Python\Anaconda3\lib\site-packages\werkzeug\utils.py", line 418, in import_string
__import__(import_name)
File "D:\Python\Anaconda3\lib\site-packages\flask_mongoengine\panels.py", line 5, in <module>
from flask_mongoengine import operation_tracker
File "D:\Python\Anaconda3\lib\site-packages\flask_mongoengine\operation_tracker.py", line 26, in <module>
'_unpack_response': pymongo.helpers._unpack_response,
AttributeError: module 'pymongo.helpers' has no attribute '_unpack_response'
任何人都知道这可能是什么原因?我最终试图写一些甚至可以远程使用Mongo + Flask的东西...
答案 0 :(得分:1)
@Ants flask-mongoengine一直没有维护好几年,但是现在在当前的主站中使用MR https://github.com/MongoEngine/flask-mongoengine/pull/372
进行了修复答案 1 :(得分:0)
看起来这是与较新版本的PyMongo相关的已知错误(Issue #325)。当前的解决方法是恢复到3.5.1。
如果您运行pip install pymongo==3.5.1
,则MongoDebugPanel将再次运行。