Connect streamlit to mongo atlas (network access)

Hi guys,

I’ve created an app that connects with mongo atlas. But to make it work I’ve to set “ALLOW ACCESS FROM ANYWHERE”, if I did not give access I receive “ServerSelectionTimeoutError”.

Could you help me restrict access to just the Streamlit?

my app


Hi @Daniel_Castagna

Perhaps you could specify the Streamlit network URL which is by default available at port 8501.

Please see the following relevant Docs:

The following blog may also be helpful as it shows an app deployment using MongoDB:

Hi, I face the same concern as Daniel as I only managed to make the connection between the deployed streamlit app and MongoDB with

I couldn’t find clear explanation on how this could be addressed in the provided links above and I’m sorry If I missed the right content.

If there is available explanation on the scenario would be great to be shared. I couldn’t find it the streamlit documentation or Mongo DB, or StackOverFlow for now - will continue looking for ideas :slight_smile: