Hi Bbake, You can also use a multi DB setup <https://docs.djangoproject.com/en/2.2/topics/db/multi-db/> (I suggest routers), and follow this guide to integrate a Mongo backend: https://medium.freecodecamp.org/using-django-with-mongodb-by-adding-just-one-line-of-code-c386a298e179
One drawback that you lose relationships across DBs, but I think you already prepared for that. Hope this helps, Szabolcs On Fri, May 10, 2019 at 2:10 PM Chetan Ganji <[email protected]> wrote: > Hi Bbake, > > Django Class Based Views and Models are wired for relational databases > only. If you want to use MongoDB with django you have to say bye bye to CBV > and Django ORM. There are some third party libraries to map django models > to mongo, but IDK how good they are for production use. > > One way to solve this problem is use Function Based Views for views where > MongoDB will be used. > You will have to access mongo db using a database driver like pymongo. > > If you just need to store the json data, another way to solve this problem > is to use django and postgres database. > PostgreSQL has JSON field, django also supports that. Check the official > documents for more info. > https://docs.djangoproject.com/en/2.2/ref/contrib/postgres/fields/ > > If you find any more solutions, please let me know, as I also want to > explore the options of using mongo with django. > Thanks in advance. > > > Regards, > Chetan Ganji > +91-900-483-4183 > [email protected] > http://ryucoder.in > > > On Fri, May 10, 2019 at 5:27 PM Bbake Waikhom <[email protected]> wrote: > >> Is there any way that I can use different database type in a single >> Django project like some model A will use SQL and some model B will use >> MongoDB? Because in my project some data are better to store in a >> relational database and some are better to store in a NoSQL database. I've >> been searching for a while to achieve this but I couldn't find any >> solution. Please let me know if there is a way. Thank you. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/b3776d83-18c9-47a0-9a8a-e3e7cb2e849a%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/b3776d83-18c9-47a0-9a8a-e3e7cb2e849a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAMKMUjvwPcizHF%3DRrdJai9j8C2BakWj7XpMMK_O%2BbntuByHrTw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAMKMUjvwPcizHF%3DRrdJai9j8C2BakWj7XpMMK_O%2BbntuByHrTw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFp9oi9ZCeLQWQu6hmXvJdy%3Df6KWhDTQuaS79SrP45U%2Bo1ToCA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

