Django for MongoDB的设置引发错误

时间:2016-04-02 15:52:58

标签: python django mongodb python-3.x mongoengine

我想在我的应用程序和I used this documentation as reference中使用MongoDB。

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.dummy',
    }
}

SESSION_ENGINE = "mongoengine.django.sessions"

_MONGODB_HOST = "localhost"
_MONGODB_NAME = "erayerdin_blog"
_MONGODB_DATABASE_HOST = "mongodb://{}/{}".format(_MONGODB_HOST, _MONGODB_NAME)

mongoengine.connect(_MONGODB_NAME, host=_MONGODB_DATABASE_HOST)

如果我想django.db.backends.dummyImproperlyConfigured或空字符串只会引发migrate。如何在Django中传递虚拟引擎?

raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

环境

  • django 1.9.5
  • mongoengine 0.10.6
  • pymongo 3.2.2
  • python 3.5.1

1 个答案:

答案 0 :(得分:1)

这是“Dummy”后端的预期行为 - 它充当存根/默认后端,如果您实际start to use it - migrate尝试使用虚拟后端,它会开始抱怨。< / p>