[Answered ]-Django connect to mysql and mongodb

1👍

You wrote mongodb at the same level as 'TEST', etc. This thus means that you only defined one database, and that mongodb is a key of that dictionary.

You thus should specify the mongodb database at the same level like the default database:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '*****',
        'USER': '*****',
        'PASSWORD': '*****',
        'HOST': '1*****',
        'PORT': '1*****',
        'TEST': {
            'NAME': '*****',
            # 'CHARSET': 'utf8',
        }
    },
    'mongodb':  {
        'ENGINE': 'djongo',
        'NAME': '*****',
        'USER': '*****',
        'PASSWORD': '*****',
        'HOST': '*****',
        'PORT': '*****',
        'TEST': {
            'NAME': '*****',
            # 'CHARSET': 'utf8',
        },
    }
}

Leave a comment