I am working with an Django application which uses Django 1.8 version.
Most of the data we deal with is JSON formatted ones. We are trying to implement any NoSQL database.
But I see that MONGODB is not compatible for version 1.8 and over and Is there any NoSQL database that can be efficiently mapped to Django 1.8 or over ??
Thanks in advance.
NoSQL databases are not officially supported by Django itself. There are, however, a number of side project and forks which allow NoSQL functionality in Django, like Django non-rel.
You can also take a look on the wiki page which discusses some alternatives.
This is quoted from the django official documentation
Here is an interesting repo for allowing using MongoDB as your django backend. It works by compiling SQL commands into MongoDB document queries.
Most of the basic stuff like django admin, django session etc all work.
https://github.com/nesdis/djongo
Years after (2022), djongo is still the only option which works fine with Django 3.0.x as well (with some constraint restrictions) in NoSQL environment.
But now that Django's 4.0.1 major release is in the air, djongo's latest 1.3.6 (released in June 2021 according to pypi) is beginning to break. In my experience with Django==4.0.4 and djongo==1.3.6 together, almost none of the select/update queries work, and SQLDecodeError exceptions lay around in console.
djongo maintainer(s) have created paid subscription plans as well, but I have not been their customer like that so can't comment anything about the commercialized version of djongo. Rest, the open-sourced AGPL licensed djongo is the only best option for unpaying developers to use Django with MongoDB, given that the developer restricts themselves to Django 3.0.x.
I've been using Django==3.0.5 with djongo==1.3.6, to be specific here, which works fine in most of the circumstances.
Related
I want to use the MongoDB database in Django.
Officially there are no Django-MongoDB drivers available. I found some third-party sources, but they're outdated. I found some projects on GitHub, but they are also outdated (last updated 2-3 year ago).
What are my option? Is there any official support for MongoDB in Django?
This tutorial looks like best solution at this point.
You need to install django#nonrel and djangotoolbox so non-relational db can work properly on your django project.
After installing mongodb-engine just activate it in settings.py file
Is the maintenance and support for Django MongoDB Engine still active? I searched online and found that the original author of Django MongoDB Engine already quit the project. I am wondering if it supports Django 1.8. If not, I would switch to another mongo ORM such as mongoengine.
Related question (with no answers): configuration of django_mongodb_engine with django 1.8 or any other way to use MongoDB
Django-mongodb-engine is no longer keeping up with the latest Django improvements As a web developer you can take up the challenge of connecting Django to MongoDB in several ways, but depending on what strategy you chose you may run out support from the authors sooner or later. There are several reasons for that. Listed below are some:
Use a MongoDB compatible model framework: Use a third party framework like MongoEngine or Ming in your django projects. However will miss out on:
1500+ core contributors to the project,
Hourly fixes and ticket resolution,
Ramp down on the expertise of existing Django models and ramp up on the new model framework.
Perhaps the biggest drawback is that your project can’t use any of Django’s contrib models! Forget about using Admin, Sessions, Users, Auth, etc., contrib modules for your project!
Alternatively you can try:
Django SQL to MongoDB connector — Djongo: The strategy is to translate Django SQL query syntax generated by the Django ORM into pymongo commands. Djongo is a SQL to MongoDB query compiler. It translates every SQL query string into a mongoDB query document.
SQL syntax will never change regardless of future additions to Django, by using a connector instead of a different ORM, your project will work on all versions of Django.
What are the differences between the Mongoengine, flask-MongoEngine and Django-MongoEngine projects?
I am using Mongoengine in my Django project. Will I get any benefits if I use Django-MongoEngine instead?
Django MongoEngine aim is to provide better integration with Django - however currently (June 2014) its not stable and the readme says
DO NOT CLONE UNTIL STABLE
So beware!
In addition to the other answers, flask mongoengine adds support for wtforms. If your not using flask admin, or doing server side rendering, chances are you don't need flask-mongoengine. You can just go with mongoengine
flask-mongoengine adds a few helpers to integrate MongoEngine into a Flask application.
Connection definition in Flask parameters
get_or_404 / first_or_404 shortcuts (abort 404 if document not found)
paginator added to QuerySet object
automatic form generation using WTForms
django support was pulled off Mongoengine into a separate code (django-mongoengine). Although it has no release, it seems to be worked on (see the recent commits).
Django framework provides a unified unified interface to connect to a Database backend which is usually an SQL based database such as SQLite or Postgresql. That means that the developer does not have to worry about writing code specific to the database technology used, but defines Models and perform transactions and run all kinds of queries using the Django database interface. Flask does the same.
Django does not support MongoDB from the get-go. To interact with MongoDB databases, Collections and Documents using Python one would use the PyMongo package, that has a different syntax, and paradigms than Django Models or Flask's.
MongoEngine wraps PyMongo in way that provides a Django-like Database for MongoDB.
MongoEngine-Django tries to allow Django web-apps developers to use a Mongo database as the web-app backend. To provide the Django Admin, Users, Authentication and other database related features that are available in Django usually with an SQL backend.
MongoEngine-Flash tries to allow Flask web-apps developers to use a Mongo database as the web-app backend.
Personally, I prefer using a structured SQL database for the web-app essentials, and PyMongo, or MongoEngine to interface with any further Mongo Databases where unstructured big data might reside...
I'm looking to write a small web app to utilise a dataset I already have stored in a MongoDB collection. I've been writing more Python than other languages lately and would like to broaden my repertoire and write a Python web app.
It seems however that most if not all of the current popular Python web development frameworks favour MySQL and others with no mention given to MongoDB.
I am aware that there are more than likely plugins written to allow Mongo be used with existing frameworks but so far have found little as to documentation that compares and contrasts them.
I was wondering what in people's experience is the Python web development framework with the best MongoDB support?
Many thanks in advance,
Patrick
I have not tried MongoKit although it has been around for a while and retains a good reputation. I personally prefer MongoEngine and feel very comfortable with it (maybe because I like its nice homepage and good documentation). There is also a very good opensource project named Mumblr which demonstrates a Django-MongoEngine-MongoDB combination, which I think a very good starter for any project. I'm developing a CMS for my own company using this app.
I've used MongoKit with Pylons before and it worked out good.
You might want to refer to this post though: MongoDB ORM for Python?
There is no stable support for mongodb using django framework. I tried using mongoengine, but unlike models, provided for admin in django framework, there is no support for mongoengine.
Correct if I am wrong.
Flask is the best framework to use with MongoDB. It has a mongodb library called flask-pymongo
Make sure you run the following commands before starting your project.
$ pip3 install Flask
$ pip3 install Flask-PyMongo
My current Django setup uses MySQL as the main database to store models. Now for my project I need to connect to a remote PostgreSQL database and retrieve data from it. Is it possible to do this by using built-in Django and Python features or I will need to use library such as Psycopg2?
It would be great for me, if I will be able to use the Object-relational mapper of Django for this remote database.
Any ideas would be more than welcome.
Django Project is working on Multiple Database Support. There is also a recent (Nov 10 2009) blog post about "The state of MultiDB (in Django)".
Update: Multiple Databases is supported since Django v1.2 (release May 2010).