Mortafix / streamlit-mongo

Streamlit MongoDB Connector: An efficient connector for interfacing MongoDB with Streamlit apps, developed for the Streamlit Connections Hackathon.
https://mongo-connector.streamlit.app
MIT License
6 stars 2 forks source link

Issue with secrets toml #1

Open Aurelien7877 opened 9 months ago

Aurelien7877 commented 9 months ago

Hello !

Thanks for your package.

It seems to have a bug with the secrets part. I'm doing a very simple connection with my mongodb cluster.

Error : KeyError: 'st.secrets has no key "type". Did you forget to add it to secrets.toml or the app settings on Streamlit Cloud? More info: https://docs.streamlit.io/streamlit-cloud/get-started/deploy-an-app/connect-to-data-sources/secrets-management' Traceback: File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 534, in _run_script exec(code, module.dict) File "C:\Users\aurel\OneDrive - De Vinci\ONE DRIVE PC\A5\Structure données cloud\Livrable4\appV2.py", line 4, in conn = st.connection( File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\runtime\connection_factory.py", line 300, in connection_factory type = secrets_singleton["connections"][name]["type"] File "C:\Users\aurel\AppData\Local\Programs\Python\Python39\lib\site-packages\streamlit\runtime\secrets.py", line 92, in getitem raise KeyError(_missing_key_error_message(key))

Any clue ?

Mortafix commented 9 months ago

Hello, can you give me the structure of your st.secrets file so I can better understand the problem?

EmiyaHang commented 3 months ago

hi,I don't know where to put the secrets file in my local PC

Mortafix commented 3 months ago

The secrets.toml file needs to be places inside the .streamlit folder on your project root folder.

project
|_ .streamlit
   |_ secrets.toml
...
|_ requirements.txt
|_ app.py