Django with NoSQL database

23,714

Solution 1

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

Solution 2

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

Solution 3

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.

Share:
23,714

Related videos on Youtube

Bhargav
Author by

Bhargav

Updated on April 17, 2022

Comments

  • Bhargav
    Bhargav about 2 years

    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.

    • knbk
      knbk over 7 years
      NoSQL is not supported by the ORM, but you can of course use NoSQL with other Django features, or alongside a relational database. What features are you looking for specifically?
    • Bhargav
      Bhargav over 7 years
      The data we receive from other applications are in purely JSON format. So that is the reason we wanted to include Nosql db (mongo db). But the point you mentioned seems like a possible option for us with future perspective. Thanks.
  • Bhargav
    Bhargav over 7 years
    but they all use Django 1.5 or lesser :(
  • Rahul Reddy Vemireddy
    Rahul Reddy Vemireddy over 7 years
    django-mongodb-engine.readthedocs.org check this out. This is referred in Django docs of 1.8 and 1.10
  • Bhargav
    Bhargav almost 7 years
    Thanks, Will check it. :)
  • devnull
    devnull over 6 years
    I have just tested several options including Django-nonrel and older packages. None are working fine (especially the admin). Djongo works very well and seems to be the only modern working solution.
  • devnull
    devnull over 6 years
    Django non-rel and Django-mongodb engine are not working properly. First is only 1.5 AND the admin doesn't work. The project seems abandoned. Best current option is the DJONGO package working fine with Python 3.5+ and the Django 1.11
  • Paul Bissex
    Paul Bissex over 4 years
    2020 update: this does indeed look like the most, if not the only, functional option for current versions of Django.
  • bitoffdev
    bitoffdev over 2 years
    Djongo is also less likely to break with future updates to Django since it works by transpiling SQL to Mongo's query language. Unlike other projects (like non-rel), Djongo fits very nicely into the existing interfaces exposed by Django, which are designed with SQL backends in mind.