我的 Settings.py 文件有
DATABASES = {
'default' : {
'ENGINE' : 'django_mongodb_engine',
'NAME' : 'my_database'
}
}
当我尝试运行django
时,出现以下错误。
I have attached the screenshot of the error
我参考了这份文件https://django-mongodb-engine.readthedocs.io/en/latest/topics/setup.html MongoDb在27017端口启动并运行 Django版本:1.7 Python:3.4.3
请建议使用django设置mongodb的解决方案。
答案 0 :(得分:0)
我发现很少原因为什么MongoDb-engine(Python ORM形式的mongo数据库)教程无效:
要连接到数据库,您应该输入以下代码 settings.py
DATABASES = {
'default' : {
'ENGINE' : 'django_mongodb_engine',
'NAME' : 'my_database'
}
}
他们没有活跃的开发者社区
<强>解决方案:强> 请遵循本教程中的python&gt; = 3.5并使用mongoengine作为MongoDb的python对象数据映射器。 http://docs.mongoengine.org/tutorial.html 要连接到数据库,请将以下代码放入项目settings.py
中DATABASES = {
'default' : {
'ENGINE': 'django.db.backends.dummy'
}
}
from mongoengine import *
connect('dbname') #Database name that you want to use it for the project
的更多信息