-
Create a virtual environment of your choosing. Below is a pyenv example. To truly understand the magic of pyenv (which helps you manage multiple versions of python!) check out these install & setup instructions (see the Installation section of this page for help)
To create virtualenv:
pyenv virtualenv 3.8.7 members
To activate virtualenv:
pyenv activate members
To deactivate virtualenv:
source deactivate
To run locally (default Local URL: http://localhost:8501)
streamlit run membership.py
One option to deploy for free is Streamlit.io
Warning
To deploy on Streamlit Cloud, repo MUST be public unless it is your ONE free private app. To replicate this app's setup, take below steps to protect your data & add some admittedly minimal authentication.
📝 Tips
- Start with relatively simple app setup.
- Then use secrets management and caching to layer in options.
- Test connections & configurations locally
.streamlit/secrets.toml
before deploying⚠️ Update.gitignore
to protect secrets.- Add to production by going to the app dashboard and in the app's dropdown menu, click on Edit Secrets. Copy the content of
secrets.toml
into the text area.
Note
- Layer in new connections & configurations gradually.
- Add them locally & then again in deployment.
- If you want until everything works locally before deployment, it might still fail, and it will be MUCH harder to debug.
- If app deployed & you are app owner, you can debug deployment in Manage App tab in bottom right corner of app.
- Make repo public.
⚠️ CAREFUL - Deploy on Streamlit Cloud
- Add users & passwords authentication without SS0.
- Connect to datasource(s) using secrets management and caching. Check out tutorials.
Note
google.oauth2
not working invirtualenv
. Continuing to dev outside virtualenv.
Note
Streamlit tutorial points to deprecated and limited python library to interface with Google Sheets.
gspread
is a great alternative!
- Easy, accessible
- Great for keeping everything in house
Warning Transfer to another party would take several not so straightforward steps. Alternative DB solutions are potentially better for clients & external partners
- link via steps... (see above)
- revoke assess to sheet from everyone. limit to authorized users
- add service email to authorise email - VIEW ONLY!
- separate sheets in same doc can be linked to as unique urls. makes things contained
Note Everything in
secrets.toml
accessible by others in your org. Secrets are not exactly secret there.
Note Everything in
secrets.toml
accessible by others in your org. Secrets are not exactly secret there.
- Logic checks if there's username in sheet & if there is a username password match
- Import directly into private google sheet using custom AppScript. Thank you, @bradspar, for your example that uses Basic Auth and doesn't break!!
- More info on source can be found by reaching out to in to tech team for authorization. HINT: There's a Workday - Airtable Reports document with all the necessary details.
Note reading data from Google Sheets changes the default datatypes and some columns name formats might need extras handling.
- Defined by Slack channel membership currently. Limited in that they are only snapshot lists.
- Go to settings of Slack channel
- Copy member emails
- Examples can be entered manually user into app
Note To add into backend of app takes some coding.