You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Connection issue and also connecting to wrong database with Mongo atlas (Connection time out for first request to login page). #404
MONGODB_SETTINGS = {
'db': 'xyz',
'host': 'mongodb+srv://xyz-3inen.mongodb.net',
'username': 'root',
'password': 'your_password'
}
when I don't pass database name in host i.e 'mongodb+srv://xyz-3inen.mongodb.net/xyz', it gets connected to test DB even if db and name key is present in MONGODB_SETTINGS
as I dug in, I found _sanitize_settings in connection returns "test" for DB due to URL parsing if it finds any name in URI then it assigns it or else test is the default database. so I tried passing database name in URI
The strange thing is, when the database is being connected to the test database everything works fine.
but the same is not true when I pass the database name in URI.
My first login screen gets stuck on the same screen until I refresh it, but still, the login gets successful i.e it is somehow able to get the login data for validation and validates the user in the database.
I even tried connecting using URI, the connection gets timed out for the first login request until I refresh it.
EDIT NOTE:
Now I am using connect=False but still the first request didn't get served, I Guess it's messing with flask threads something.
Hope if someone can help to get out of this
MONGODB_SETTINGS = {
'db': 'xyz',
'host': 'mongodb+srv://xyz-3inen.mongodb.net',
'username': 'root',
'password': 'your_password'
}
when I don't pass database name in host i.e 'mongodb+srv://xyz-3inen.mongodb.net/xyz', it gets connected to test DB even if db and name key is present in MONGODB_SETTINGS
as I dug in, I found _sanitize_settings in connection returns "test" for DB due to URL parsing if it finds any name in URI then it assigns it or else test is the default database. so I tried passing database name in URI
The strange thing is, when the database is being connected to the test database everything works fine.
but the same is not true when I pass the database name in URI.
My first login screen gets stuck on the same screen until I refresh it, but still, the login gets successful i.e it is somehow able to get the login data for validation and validates the user in the database.
I even tried connecting using URI, the connection gets timed out for the first login request until I refresh it.
EDIT NOTE:
Now I am using connect=False but still the first request didn't get served, I Guess it's messing with flask threads something.
Hope if someone can help to get out of this
Activity
Clickative commentedon Aug 21, 2020
Same error here!
mishraamrish commentedon Aug 21, 2020
It works fine with gunicorn but the same is not true with UWSGI and flask local development server, even if connect=False.
pythonhubdev commentedon Dec 27, 2020
Did you try it out with
connect=True