Using Azure Cosmos DB with Django

Hi, I wanna use Azure Cosmos DB as a MongoDB. So, Djongo seems to be the best choice to do that. But how do I set the settings? Azure gives me such fields in connection string:
HOST, PORT, USERNAME, PRIMARY PASSWORD, SECONDARY PASSWORD, SSL(boolean - true as default).
Currently I have:

DATABASES = {
    'default': {
        'ENGINE': env.str("SQL_ENGINE"), # djongo is set here
        'ENFORCE_SCHEMA': False,
        'CLIENT': {
            'host': env.str("SQL_HOST"),
            'port': env.int("SQL_PORT"),
           'username': env.str("SQL_USERNAME"),
            'password': env.str("SQL_PASSWORD"),
        },
    },
}

I have installed:
Django 3.0.5
Djongo 1.3.3
sqlparser 0.2.4

The Djongo docs appear to address this in the Django and MongoDB connector docs.

Yes, I saw that, but somehow I cannot get it working with Azure. There’s something I’m doing wrong :confused:

Your snippet above doesn’t include all the entries as listed in the referenced doc page.

Hi, thanks for help. I found a solution. It missed one setting: ssl: True. Now it works :slight_smile:

Hi @KGuzikowski can you share the snippet, how to connect?