我将 app.py 文件编辑为仅通过 MongoEngine 使用 MongoDB(您可以选择 MongoDB 或 SQL)。这是我尝试运行我的应用程序时的输出:
Familys-imac:flask-security Paul-Arthur$ python app.py
Traceback (most recent call last):
File "app.py", line 17, in <module>
from flask.ext.security.datastore import MongoEngineUserDatastore
File "/Library/Python/2.7/site-packages/flask/exthook.py", line 86, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named flask.ext.security.datastore.MongoEngineUserDatastore
对我来说,这表明 MongoEngine 存在问题(请注意,这是在 virtualenv 中)。
因此我尝试重新安装软件包,认为这可能是问题,但我也没有运气。输出接缝完全正常,这是怎么回事?
familys-imac:flask-security Paul-Arthur$ pip install MongoEngine
Requirement already satisfied (use --upgrade to upgrade): MongoEngine in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): pymongo in /Library/Python/2.7/site-packages (from MongoEngine)
Cleaning up...