Hi everyone I want to use django's built in authentication with mongodb. I have looked online and they aren't really any stable and solid solutions.
Has anyone mongodb fans out there who can point out to me how this can be achieved with minimal hacking? That would be great.
There are three ways to connect Django to MongoDB: PyMongo: PyMongo is the standard driver through which MongoDB can interact with Django. It is the official and preferred way of using MongoDB with Python. PyMongo provides functionality to perform all the database actions like search, delete, update, and insert.
Django provides an authentication and authorization ("permission") system, built on top of the session framework discussed in the previous tutorial, that allows you to verify user credentials and define what actions each user is allowed to perform.
Both PyMongo and MongoEngine can be used to access data from a MongoDB database. However, they work in very different ways and offer different features. PyMongo is the MongoDB recommended library. It makes it easy to use MongoDB documents and maps directly to the familiar MongoDB Query Language.
PyMongo is the official distribution recommended by Python to connect your Django application to a MongoDB database. PyMongo is an open-source Python distribution containing tools for interacting with MongoDB. It makes it easier to perform CRUD operations (Create, Read, Update, and Delete) with a MongoDB database.
You can't simply use Django built in authentication with MongoDB because MongoDB is not supported as a back-end for django.db which is an ORM for Django Authentication. However you may use 3rd modules like MongoEngine or MongoKit to overcome this problem as they all provide Authentication Module for MongoDB Django apps.
Note: The folks at MongoEngine provide an awesome open source project named Mumblr which is good to use as a starter for your Django-MongoDB project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With