I made a web app at explosive speed using Streamlit, Python's open source framework.
I will add the necessary files to the directory of the web application created with Streamlit and develop it on heroku. What you need
requrements.txt
It makes the server aware of what it needs to download in order to execute the code.
Add streamlit
and numpy
and pandas
as needed.
Below is an example.
requrements.txt
streamlit==0.60.0
matplotlib==2.2.3
numpy==1.15.1
App not compatible with buildpack I get an error requirement.txt make runtime.txt Procfile
setup.sh
Like requirements.txt
, setup.sh
creates an environment where the app runs on the server. Please change the email individually.
setup.sh
mkdir -p ~/.streamlit/
echo "\
[general]\n\
email = \"[email protected]\"\n\
" > ~/.streamlit/credentials.toml
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
" > ~/.streamlit/config.toml
Procfile It describes what command the server should execute.
web: sh setup.sh && streamlit run {name_of_app}.py
First login
$ heroku login
Since heroku uses Git, it always initializes the Git repository.
$ git init
$ git add .
$ git commit -m "first commit"
Then create a new instance on heroku.
$ heroku create
All you have to do is push and open it.
$ git push heroku master
$ heroku open
I also tried deploying an application that can solve TSP by the 2-opt method.
This time, I deployed Streamlit, which allows you to easily shape the deliverables with just Python. It was very explosive until deployment. If you want to know the convenience of Streamlit itself and the detonation velocity, please see Previous article! !!
Recommended Posts