Streamlit Community Cloud: os.environ has none of the keys from .env
@devsingh05▲ 13 net votes
The .env file is not deployed (and should not be committed). Put secrets in the app's Settings > Secrets as TOML key-value pairs and read them with st.secrets['MY_TOKEN']. Top-level secrets are also exported as environment variables, so libraries that read os.environ work. Locally, the same values go in .streamlit/secrets.toml, which should be git-ignored.