I'm deploying a django project using zappa to aws-lambda and using mongodb atlas as my database. I'm tring to connect to the database using djongo. I set my django_setting in the zappa_settings.json to my project's django settings. The connection to the database with this settings works just fine in localhost. when deploying, it fails to connect to the server and I suspect that it tries to connect to a default local db (the db sent to mongo_client.py isnt valid or something and it needs to connect to default HOST).
The actual error I get is:
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
djongo.sql2mongo.SQLDecodeError: FAILED SQL: SELECT
If anyone has an idea I'd would love to hear.
attaching the settings with some fields unset (but set at my settings)
Django settings (database part):
DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'db',
'HOST': 'mongodb://<username>:<password>@<>
'USER': 'username',
'PASSWORD': 'password',
}
}
zappa_settings:
{
"dev":
{
"aws_region": "eu-west-1",
"django_settings": settings,
"profile_name": "default",
"project_name": name,
"runtime": "python3.6",
"s3_bucket": bucket,
"timeout_seconds": 900,
"manage_roles": false,
"role_name": name,
"role_arn": arn,
"slim_handler": true
}
}