mongoengine沒有在setting.py中定義,儘管pip有它。mongoengine沒有在setting.py中定義,雖然pip有它
PIP列表顯示 pip list show
serveral的調試之後,我覺得setting.py未能導入mongoengine。 然後我試着降級mongoengine,pymongo並升級django,但沒有任何變化。
的錯誤代碼顯示ImproperlyConfigured
加註( 「setting.DATABASES配置不正確。」 django.core.exceptions.ImproperlyConfigured:設置.DATABASES是不適當configured.Pleas供給ENGINE值檢查.. 。
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#mongo
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
# Database -MONGODB
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.dummy'
}
}
from mongoengine import connect
connect('employeedb', username='woosungchu', password='1234')
SESSION_ENGINE = 'mongoengine.django.sessions'
SESSION_SERIALIZER = 'mongoengine.django.sessions.BSONSerializer'