This is a sample Streamlit app, which should make for quick python development of web tools, similar to R Shiny apps. It's fairly straightforward and requires no web development or Javascript experience. See their full docs here.
To get started, clone the repo. Copy the .env.sample
file and input the values from the Google Authentication instructions below.
For development, I've used pipenv
to standardize production.
- Run
pipenv install
to download the relevant packages. - Run
pipenv shell
to create and enter a virtual environment . - Run
streamlit run app.py
to run the app locally. It can be refreshed from the page or automatically.
This project is dockerized, using the pipenv, so you can easily deploy it in the cloud or a virtual machine. If you want, add the environment variables into the docker compose file (securely).
In addition, I've made this sample require Google authentication. You can control users with access in google cloud platform.
To set up the google authentication follow the following steps, borrowed from this blog post:
- Go to the Google API Console OAuth consent screen page.
- Choose Internal so only users within your organization can access the app.
- Fill in the necessary information.
- Click Add Scopes and add any necessary scopes you require. For this example, we don’t need any.
Next, we need to create an authorization credential from GCP:
- Go to the Credentials page in GCP Console
- Click on Create Credentials > OAuth client ID.
- Select Web Application for Application type and fill in the name for your client.
- Fill in redirect URIs for your application. These are the links you want the users to be redirected back to after logging in. For example, in local environment, you can use
http://localhost:8501
- Note down the Client ID and Client Secret for later.