MongoDB 的 Django 设置引发错误

Settings of Django for MongoDB Raises Error

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

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)

如果我想 migrate,要么 django.db.backends.dummy 要么空字符串简单地引发 ImproperlyConfigured。我如何在 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.

环境

这是 "Dummy" 后端的预期行为 - 它充当 stub/default 后端,如果你实际上 start to use it - migrate 试图使用虚拟后端。