My Settings.py file has
DATABASES = {
'default' : {
'ENGINE' : 'django_mongodb_engine',
'NAME' : 'my_database'
}
}
When I try to run the django
I get the following error. I have attached the screenshot of the error
I refered to this document https://django-mongodb-engine.readthedocs.io/en/latest/topics/setup.html MongoDb is up and running in the port 27017 Django Version:1.7 Python :3.4.3
Please suggest the solution to setup the mongodb with django.
I found few reasons why MongoDb-engine(Python ORM form mongo database) tutorial was not working:
And to connect to the database you should put the following code in settings.py
DATABASES = { 'default' : { 'ENGINE' : 'django_mongodb_engine', 'NAME' : 'my_database' } }
They don't have active developer community
Solution: Follow this tutorial for python>=3.5 and use mongoengine a python object data mapper for MongoDb. http://docs.mongoengine.org/tutorial.html to connect to the database put the following code in your project 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
For more info on Development
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.