如何将 Django 与 MongoDB 结合使用
有人可以告诉我如何使用 Django MongoDB 引擎吗?
我已按照此处的说明进行操作: http://django-mongodb.org/topics/setup.html< /a>
我得到的只是这个错误:
django.core.exceptions.ImproperlyConfigured: 'django_mongodb_engine.mongodb' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named django_mongodb_engine.mongodb.base
Can someone tell me how to use Django MongoDB Engine?
I have followed the instructions here: http://django-mongodb.org/topics/setup.html
All I get is this error:
django.core.exceptions.ImproperlyConfigured: 'django_mongodb_engine.mongodb' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named django_mongodb_engine.mongodb.base
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
应该是 django_mongodb_engine ,而不是 django_mongodb_engine.mongodb 。
Should be
django_mongodb_engine
, notdjango_mongodb_engine.mongodb
.问题是您下载包的位置不在您的 PYTHONPATH 中,因此 django 无法导入它。
如果您按照这些说明操作,则需要从您创建的 virtualenv(示例中的
myproject
)运行您的应用程序。或者,您需要将其添加到您的
PYTHONPATH
以确保 django 可以导入它。您应该能够运行 python 交互式 shell 并执行
import django_mongodb_engine.mongodb
而不会出现任何错误。The problem is that the location where you downloaded the package is not in your
PYTHONPATH
, so django cannot import it.If you followed those instructions, you need to run your application from the virtualenv you created (
myproject
in the example).Or, you need to add it to your
PYTHONPATH
to make sure django can import it.You should be able to run the python interactive shell and execute
import django_mongodb_engine.mongodb
without any errors.我在这里找到了答案: https://stackoverflow.com/questions/5699521/django-mongodb -i-cannot-update
本质上需要安装:
•django-mongodb-engine
•pymongo
•django-nonrel
•djangotoolbox
•mongo引擎
I found the answer with here: https://stackoverflow.com/questions/5699521/django-mongodb-i-cannot-update
Essentially one will need to install:
•django-mongodb-engine
•pymongo
•django-nonrel
•djangotoolbox
•mongoengine