djongo icon indicating copy to clipboard operation
djongo copied to clipboard

Connection error when using migrate or makemigrations - Azure Cosmo DB - mongodb

Open wotero opened this issue 5 years ago • 3 comments

After using the connection string given by Azure Cosmo DB, the djongo/pymongo triggers an error.

pymongo.errors.ServerSelectionTimeoutError: hangapp.documents.azure.com:10255: timed out

This is the string that I have been using in Django for the database.

DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'hangapp', 'HOST': 'mongodb://:[email protected]:10255/test?retryWrites=true&w=majority',
} }

It seems the problem is the ssl connection equal true. I have used Atlas with the next string and it works.

DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'hangapp', 'HOST': 'mongodb+srv://:@hangapp-66zxu.azure.mongodb.net/test?retryWrites=true&w=majority', } }

I have connected to azure in local, and it works using the Mongo DB Compass software.

Has somebody had the same problem?

wotero avatar Sep 15 '19 18:09 wotero

i'm having the same issue

mgsaltman avatar Sep 20 '19 21:09 mgsaltman

any fix? I also am getting other errors trying to use cosmos :(

wdifruscio avatar Jan 06 '20 17:01 wdifruscio

This is the configuration I'm using

    'default': {
        'ENGINE': 'djongo',
        'ENFORCE_SCHEMA': False,
        'NAME': 'yourdatabasename',
        'CLIENT': {
            'host': 'yourdatabasename.mongo.cosmos.azure.com',
            'port': 10255,
            'username': 'theusernameyouset',
            'password': 'thelongonefromtheportal==',
            'authMechanism': 'SCRAM-SHA-1',
            'ssl': True,
            'tlsAllowInvalidCertificates': True,
            'retryWrites': False
        }    
    }

tonybaloney avatar Apr 26 '21 00:04 tonybaloney