본문 바로가기
Tools

Heroku - App publication

by wycho 2021. 12. 2.

Streamlit 으로 만든 서비스를 web으로 publish 하기 위한 방법을 소개한다.

 

준비해야할 파일들 (4)

$ cat requirements.txt
lifelines==0.26.4
matplotlib==3.4.3
numpy==1.20.0
pandas==1.3.4
scikit_learn==1.0.1
seaborn==0.11.2
streamlit==1.2.0

$ cat setup.sh
mkdir -p ~/.streamlit/

echo "\
[server]\n\
headless = true\n\
port = $PORT\n\
enableCORS = false\n\
\n\
" > ~/.streamlit/config.toml

$ Procfile
web: sh setup.sh && streamlit run apps.py

$ runtime.txt
python-3.8.10

위 파일들과 app source 파일을 준비한다.

더보기

requirement.txt 파일은 다음 패키지를 이용하여 생성한다.

https://github.com/bndr/pipreqs

$ pip install pipreqs
$ pipreqs /home/project/location

 

Heroku CLI 를 설치한다.

https://devcenter.heroku.com/articles/heroku-cli

 

 

$ curl https://cli-assets.heroku.com/install.sh | sh

$ heroku login -i

$ cd ~/myapp
$ heroku create app_name
$ heroku apps
$ heroku apps:rename new_app_name --app old_app_name

$ git init
$ heroku git:remote -a new_app_name

$ git add .
$ git commit -am "better commit"
$ git branch -M master  ## branch 문제 발생시
$ git push heroku master

## buildpackage 문제 발생시
$ heroku buildpacks
$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/python

'Tools' 카테고리의 다른 글

ngrok - local PC에 접속하기  (0) 2021.12.27
Combine files  (0) 2021.12.03
WEB-based analysis  (0) 2021.11.30
Webpage with Streamlit  (0) 2021.10.28
Marp - Markdown to PPT  (0) 2021.10.13

댓글