Multiple databases (mongodb[mongoengine] and sql ) with django 1.8

喜你入骨 提交于 2019-12-02 01:23:45

You could add multiple databases for your app in your settings.py like,

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'admin_db',
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': 'localhost',
    },

    'your_desired_db_name' : {
        'ENGINE' : 'django_mongodb_engine',
        'NAME' : 'db_name'
}

For integration with mongodb, you may need to look up,

Also, you may need to look up Django documentation for multiple databases

MongoEngine does not support all Django contrib modules directly. If your projects dont need them (unlikely) you can use mongoengine directly. Otherwise you can also try

Which seems to work fine with the latest Django version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!