我创建了一个简单的 ML 仪表板应用程序,我想使用 Heroku 部署它。我使用 Streamlit 来开发仪表板。仪表板在本地执行时正常运行。
当我使用 Heroku 运行它时,我收到以下日志/错误:
2021-05-20T18:00:47.000000+00:00 app[api]: Build started by user dorrego.cabrera@gmail.com
2021-05-20T18:01:54.482407+00:00 app[api]: Deploy 573b33a2 by user dorrego.cabrera@gmail.com
2021-05-20T18:01:54.482407+00:00 app[api]: Release v4 created by user dorrego.cabrera@gmail.com
2021-05-20T18:01:54.720695+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-20T18:02:16.914037+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app.py`
2021-05-20T18:02:27.832874+00:00 app[web.1]:
2021-05-20T18:02:27.832912+00:00 app[web.1]: ? Welcome to Streamlit!
2021-05-20T18:02:27.832912+00:00 app[web.1]:
2021-05-20T18:02:27.832917+00:00 app[web.1]: If you're one of our development partners or you're interested in getting
2021-05-20T18:02:27.832918+00:00 app[web.1]: personal technical support or Streamlit updates, please enter your email
2021-05-20T18:02:27.832924+00:00 app[web.1]: address below. Otherwise, you may leave the field blank.
2021-05-20T18:02:27.832924+00:00 app[web.1]:
2021-05-20T18:02:27.833121+00:00 app[web.1]: Email: 2021-05-20 18:02:27.832
2021-05-20T18:02:28.117610+00:00 heroku[web.1]: Process exited with status 255
2021-05-20T18:02:28.586088+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-20T18:02:28.589400+00:00 heroku[web.1]: State changed from crashed to starting
2021-05-20T18:02:32.000000+00:00 app[api]: Build succeeded
2021-05-20T18:02:47.575726+00:00 heroku[web.1]: Starting process with command `sh setup.sh && streamlit run app.py`
2021-05-20T18:03:05.221238+00:00 app[web.1]:
2021-05-20T18:03:05.221259+00:00 app[web.1]: ? Welcome to Streamlit!
2021-05-20T18:03:05.221259+00:00 app[web.1]:
2021-05-20T18:03:05.221260+00:00 app[web.1]: If you're one of our development partners or you're interested in getting
2021-05-20T18:03:05.221260+00:00 app[web.1]: personal technical support or Streamlit updates, please enter your email
2021-05-20T18:03:05.221261+00:00 app[web.1]: address below. Otherwise, you may leave the field blank.
2021-05-20T18:03:05.221261+00:00 app[web.1]:
2021-05-20T18:03:05.221570+00:00 app[web.1]: Email: 2021-05-20 18:03:05.221
2021-05-20T18:03:05.699001+00:00 heroku[web.1]: Process exited with status 255
2021-05-20T18:03:05.814822+00:00 heroku[web.1]: State changed from starting to crashed
2021-05-20T18:08:32.862231+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secret-peak-69981.herokuapp.com request_id=dd7383d9-87a7-4004-b332-ea4426e9a831 fwd="73.170.73.198" dyno= connect= service= status=503 bytes= protocol=https
2021-05-20T18:08:33.588085+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secret-peak-69981.herokuapp.com request_id=6a6ce7a2-ecc6-49ae-98b4-4cd7f27319fd fwd="73.170.73.198" dyno= connect= service= status=503 bytes= protocol=https
我的Procfile 看起来不错:
web: sh setup.sh && streamlit run app.py
这是 setup.sh 代码:
mkdir -p ~/.streamlit
echo "\
[genera]\n\
email = \"dorrego.cabrera@gmail.com\"\n\
"> ~/.streamlit/credentials.toml
echo "\
[server]\n\
headless = true\n\
enableXsrfProtection = false\n\
enableCORS = false\n\
port = $PORT\n\
" > ~/.streamlit/config.toml
代码似乎安装了两次 Streamlit。有人能解释一下原因吗?