我试图在我的nitrousio django盒子上设置mongodb。关注this tutorial。
但是当我尝试启动我的django服务器时,我收到了下一个错误:
action@django-box-25197:~/workspace/django/mysite$ python manage.py runserver 0.0.0.0:3000
ImproperlyConfigured: 'django_mongodb_engine' isn't an available database backend.
Try using 'django.db.backends.XXX', where XXX is one of: u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: No module named django_mongodb_engine.base
action@django-box-25197:~/workspace/django/mysite$
我正在阅读有关此错误的信息,我认为默认情况下我没有在django的框中安装Django-nonrel,我想知道如何在我的django框中使用mongodb
这是我的dababase settings.py:
DATABASES = {
'default': {
'ENGINE': 'django_mongodb_engine', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os.environ['MONGODB_DEVELOPMENT_DB'], # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': os.environ['MONGODB_DEVELOPMENT_USERNAME'],
'PASSWORD': os.environ['MONGODB_DEVELOPMENT_PASSWORD'],
'HOST': os.environ['MONGODB_DEVELOPMENT_HOST'], # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': os.environ['MONGODB_DEVELOPMENT_PORT'], # Set to empty string for default.
}}
提前完成! :)