-Last time, you can now create web apps using Streamlit ――Because it's a big deal, let's publish it --So what you made → Chocolate Ball Viewer
--Create an account on heroku (free OK) --I have a github account
Create an app by referring to here. This article does not touch on Streamlit notation.
$ streamlit run [python-file]
Now, make sure that the app is created as expected.
This is the main part of this article. The outline of the procedure is as follows.
You need the following two files to publish your python app on heroku.
This is enough, but let's create a script to create a streamlit configuration file. It specifies the port number and so on. (It is OK to specify it as a startup option in Procfile)
Someone has put these together and created a template for publishing the Streamlit app on heroku. https://github.com/patryk-oleniuk/streamlit-heroku-template
This time I made it like this. I almost copied it from streamlit-heroku-template.
Procfile
web: sh setup.sh && streamlit run src/choco_view.py
requirements.txt (It is safer to fix the version)
pylint
pandas
scipy
matplotlib
seaborn
streamlit
setup.sh
mkdir -p ~/.streamlit/
echo "[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml
Put these together and push them to github. Private repositories are also OK.
You can also create heroku apps with commands using the CLI (the heroku tutorial is the CLI), but if you want to link with the github repository, it's easy from the web management screen. This time I will create it from the Web.
Set the service name from "Create New App" on the upper right and click "Create app".
only this
When you create, you will be able to select the deployment method. This time, select the "GitHub" tab and specify the repository to be linked.
If it can be linked, it will transition to the deploy screen.
Here, if you press "Enable Automatic Deploys" to enable automatic deployment, any updates will be automatically deployed to the specified branch of the linked GitHub repository.
When you're ready, press "Deploy Branch" from the Manual Deploy menu to start deploying.
Let's update the data and push it to github.
If you look at the management screen of heroku, you can see that it is deployed (fun).
I am measuring chocolate ball data as a hobby, so I released an app that visualizes the measurement data (see Chocolate Ball Statistics for details). https://chocolate-view.herokuapp.com/
Flavor can be selected
Simulation of the number of purchases required to hit the silver angel
end
Recommended Posts