Eve异常:重复config_prefix" MONGO"`

时间:2015-04-13 09:07:42

标签: flask pymongo eve

from views import app
    mongo = PyMongo(app)
    print mongo.db.activity.count()

因为我试图使用Pymongo count()

并提出

File "Z:\Activities\modules.py", line 9, in set_id
    mongo = PyMongo(app)
  File "D:\Python27\lib\site-packages\flask_pymongo\__init__.py", line 98, in __init__
    self.init_app(app, config_prefix)
  File "D:\Python27\lib\site-packages\flask_pymongo\__init__.py", line 122, in init_app
    raise Exception('duplicate config_prefix "%s"' % config_prefix)
Exception: duplicate config_prefix "MONGO"

但事实上我使用默认值。 我该怎么办?

1 个答案:

答案 0 :(得分:5)

PyMongo已经为您初始化,并准备好在app.data.driver消费。

尝试以下方法:

mongo = app.data.driver
print mongo.db.activity.count()