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’)>]>