Not connecting using Djongo pymongo.errors.ServerSelectionTimeoutError: [Errno 8] nodename nor servname provided, or not known,

Background: I was connecting to a mongodb.com instance using ipython at first but then I starting using djongo (which using pymongo) with django. Using the same creds this does not work.
These are the lib versions that I am using:
• django 2.2.10
• djongo 1.2.3
• pymongo 3.12.0

Settings.py file:

    DATABASES = {
    'default': {
        'ENGINE': 'djongo',
        'NAME': ENV('MONGO_DBNAME'),
        'ENFORCE_SCHEMA': False,
        'CLIENT': {
            'host': ENV("MONGO_HOST"),
            # 'port': int(ENV("MONGO_DBPORT")),
            'username': ENV("MONGO_USER"),
            'password': ENV("MONGO_PASS"),
            'authSource': ENV('MONGO_AUTHSOURCE'),
            'authMechanism': 'SCRAM',
            # "waitQueueTimeoutMS": 60000, # how many milsec to wait for timeout
            # "ssl": True,
        },
        'LOGGING': {
            'version': 1,
            'loggers': {
                'djongo': {
                    'level': 'DEBUG',
                    'propagate': False,                        
                }
            },
            },
    } 

Full Error:

pymongo.errors.ServerSelectionTimeoutError: [Errno 8] nodename nor servname provided, or not known, Timeout: 30s, Topology Description: <TopologyDescription id: 6124052c370971661d43d6bf, topology_type: Single, servers: [<ServerDescription (server_type: Unknown, rtt: None, error=AutoReconnect([Errno 8] nodename nor servname provided, or not known’)>]>

Hi @Deon_Saunders Thank you for for starting this thread. I had responded earlier on the ticket you created, but maybe you didn’t see my response?

Can you please tell us how you went about installing PyMongo with Djongo? Assuming you are connecting to a MongoDB Atlas instance, PyMongo would need to be installed with the srv extra, which can be done as follows:

pip install pymongo[srv]

I am not sure if Djongo supports the SRV extra, but if it does not, you will need to install it manually. To check whether the extra is already installed you can run pip list and check whether dnspython is already installed in your environment.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.