首页 > 解决方案 > Python - Heroku 部署错误启动超时

问题描述

我在 python 中创建了一个流式应用程序,并尝试在几个 youtube 视频之后将其部署到 Heroku。但是,我不断收到以下错误,我不知道如何纠正它们。

2020-06-20T14:53:35.863016+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-06-20T14:53:35.885669+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-06-20T14:53:35.970864+00:00 heroku[web.1]: Process exited with status 137
2020-06-20T14:53:36.011903+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-20T14:53:36.749597+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=stockinfo-sl.herokuapp.com request_id=9ef454ce-0c45-423b-84ed-c6aa8fbd5a8f fwd="73.181.67.146" dyno= connect= service= status=503 bytes= protocol=https

这是我推送到heroku的以下文件。

  1. app.py(在我的本地机器上运行的流式应用程序)

  2. 过程文件

    web: sh setup.sh && streamlit run app.py
    
  3. 要求.txt

    pandas==1.0.3
    streamlit==0.61.0
    datetime
    beautifulsoup4==4.9.1
    requests==2.23.0
    
  4. 安装程序.sh

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

我曾尝试删除该应用程序并将其推回 heroku 几次,但没有运气,也没有运气重新启动 dynos。有人看到我推送的文件有什么问题吗?谢谢。

标签: pythonherokustreamlit

解决方案


网络测功机必须$PORT在启动后 60 秒内绑定到其分配。如果没有,则由测功机管理器终止,并记录R10 引导超时错误

您需要在 procfile中传递$PORTto :streamlit

web: sh setup.sh && streamlit run --server.port $PORT app.py

这里的文档可能会有所帮助:https ://devcenter.heroku.com/articles/dynos#web-dynos


推荐阅读