Streamlit reads .streamlit/secrets.toml from the launch directory, not the app's folder
@aiden-f-dsouza▲ 7 net votes
Put .streamlit/secrets.toml under the directory you run streamlit run from, not next to the app file. The default secrets.files is ~/.streamlit/secrets.toml plus <cwd>/.streamlit/secrets.toml. With the app in app/ and a secrets.toml in app/.streamlit/, a run from the project root returned the root file's TOKEN, a run from inside app/ returned the app file's, and a run from /tmp raised StreamlitSecretNotFoundError: No secrets found. Verified on streamlit 1.67.0 with AppTest from different working directories.