What versions of Django does the Django MongoDB Engine support? - python

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.

Related

Django with NoSQL database

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.

Is Django itself a backend?

I have been reading into Python/Django but I was unable to find good info. I have learned that Django is a backend, but some people are saying that django itself runs on PostGreSQL?
So I need to learn both python/PostGreSQL? Or is DJANGO itself a backend?
Django is a python web framework. It can be used to create a backend. Django does not run on PostgreSQL, it can work with it as a database. But Django can work with many other databases as well, e.g. mysql, sqlite etc. If you want to learn web programming in python, then Django is a reasonble choice. However, there are many other popular alternatives to the Django web framework.

Difference among Mongoengine, flask-MongoEngine and Django-MongoEngine?

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...

B2B App authentication on GAE - Google Accounts or custom user base (Django or Web2Py)?

Which of these would you pick for a B2B app (targeting small/med-small businesses) built on GAE with python:
Google Accounts
Custom Users with Django
Custom Users with Web2Py
I'm very tempted to go the Google Accounts route as it's very well integrated into GAE and takes care of everything from user creation to session authentication, and even takes care of forgotten passwords. However, I'm sure there are significant drawbacks to this, including usability, but if you are starting from scratch, which approach would you pick and why?
I started with Google account, added all OpenID and quickly found that the only accounts people use for my site are google and facebook accounts. So now I only have login with google and login with facebook. But I'm going to add my own accounts and I'm doing it with webapp2 instead of django and instead of web2py. I tried web2py but webapp2 and its auth model seem much better and not like with web2py a lot of unnecessary code that is not for app engine.
Try this and its auth model (there is example code from http://code.google.com/p/webapp-improved/issues/detail?id=20) and I hope it will work for you.
Google Accounts forces users to have Google Apps or Gmail accounts. Some customers might not like this.
Rolling your own is an (unnecessary) burden: you have to have sign up process (with captcha and/or 3rd party email confirmation), keep all user records, handle the security, etc..
I'd suggest you go with OpenID: http://code.google.com/appengine/docs/python/users/overview.html#Authentication_Options
Why both Create Django user from Google users. you will be able to adapt your system user with other system next
I've understood that question was only on authentication after I've written this so most of things here are offtopic, but I just wanted to demotivate on using full-stack solutions like django or web2py in appengine.
I can tell you something about django because I've used it for over a year and I do like it for certain types of websites. It was first framework which I've tried to use on appengine and I've dropped it after two weeks.
These are things in django which doesn't work or make no sense in appengine:
django models and orm: designed for sql; appengine sdk has its own models.
django admin site: is designed for sql databases, doesn't work on appengine
auto-forms from models: designed for django models
django management commands: none of commands which come with django is useful when working with appengine SDK.
django development server: appengine sdk has its own development server, django's one does not work.
django "plugable apps" architecture: at least in my practice it was useless on appengine.
static files collector: great tool to collect static files from various reusable applications into one folder, only if you have many reusable applications.
There exists django-nonrel project which says it can run django with admin site on appengine. It can, with half of things working and a lot of bugs. You spend more time trying to fix what does not work than building things.
What might be useful from django framework:
django forms: can be exchanged for a better library WTForms
django url routing: can use Werkzeug instead
django request/response objects and HTTP exceptions: can use Werkzeug instead
django pretty-printing exceptions: Werkzeug does it better, it adds a web debugger.
django i18n and localization: can be changed with babel
django templates: jinja2 is similar and a lot faster, which is important because appengine is an expensive platform. ctypes module is required to debug errors in jinja templates, however ctypes is forbidden on appengine, but on development server it does work, for debugging you don't need more.
Actually Jinja2, Werkzeug, WTForms and babel are so cool, that there exists projects for each of them which integrates them with django.
I know two frameworks which use these libraries:
kay-framework: made for appengine, a bit outdated, but a great example how you can use Jinja2, babel and Werkzeug on appengine.
flask from Armin Ronacher, the man behind Werkzeug and Jinja2.
I've not used web2py, however since it is also a full-stack framework like django is, I think it will be as bad as django is. Full-stack solutions simply do not fit in this different environment. Simple libraries fit in any environment.

Django and multiple databases

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).

Categories