jeudi 7 juillet 2016

using mongodb alongwith postgresql in django


I want to setup a django app with postgresql for some of my tables, and mongodb for others. I am struck with it as i could not find any example that does the same. I played around and successfully connected with mongodb using mongoengine. I used a dummy backend, and put this to database settings.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.dummy'
    }
}

Now theres one possibility that if i put a proper postgresql database as default, and use dbrouters to decide whether to use mongo or postgres, this idea is very raw as i had not seen anything like this.

Another concern is, i want to expose rest api's with django rest framework, will it work with mongoengine styled models (models that inherit from mongoengines's Document) ? what will happen to Serializers/ModelSerializer then ?


Aucun commentaire:

Enregistrer un commentaire