Django Framework 1.8 with mongo db 3.0 and mongoengine 0.9

1.4k views Asked by At

MongoDb is my Database. I want to access it through Django. This iss settings. py file.

DATABASES ={

    'default':{

        'ENGINE': 'django.db.backends.dummy',  
        'NAME': 'hockey',  
        'USER': 'sud',  
        'PASSWORD': 'iiita',  
        'HOST': '127.0.0.1',  
        'PORT': '27017',  
        'SUPPORTS_TRANSACTIONS':False, 

    }

}

For ORM should i use mongoengine, django's non-rel or Django's own ORM? Do i need to install Django non-rel as i am installing mongo engine i guess it will be sufficient or not?

2

There are 2 answers

1
user3396084 On

Use mongo engine 0.9 and follow the tutorial there. You are using djangodb-mongo engine. This uses forked version of django and is completely out of date.

0
Kantanand US On

yes it will be sufficient as far as you dont not worry about django version, since django 1.10 as came out with stable release with latest security patches you won't be getting that feature with django no-rel fork

if you still want to use mongodb with django latest version then go MongoEngine is a Document-Object Mapper (think ORM, but for document databases) for working with MongoDB from Python.

PyMongo is the low-level driver wrapping the MongoDB API into Python and delivering JSON in and out.

MongoEngine or other layers like MongoKit map your MongoDB-based data to objects similar to native Python database drivers + SQLAlchemy as ORM.

One last option worth watching if you are interested in top efficiency is the asynchronous version of PyMongo, here: http://github.com/fiorix/mongo-async-python-driver