简体   繁体   English

使用 docker 将flask 应用程序部署到heroku 时出现错误R10

[英]error R10 when deploying flask app with docker to heroku

my python app runs fine as a local docker container, but when trying to deploy on heroku, i get this error:我的 python 应用程序作为本地 docker 容器运行良好,但是当尝试在 heroku 上部署时,我收到此错误:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch错误 R10(启动超时)-> Web 进程未能在启动后 60 秒内绑定到 $PORT

if __name__ == '__main__':
    from os import environ
    app.run(host='0.0.0.0', port=environ.get('PORT', 5000))

my dockerfile:我的码头档案:

FROM python:3

# set a directory for the app
WORKDIR /usr/src/app

# copy all the files to the container
COPY . .

# install dependencies
RUN pip3 install --no-cache-dir -r requirements.txt

# heroku doesn't need this
# EXPOSE 5000

# run the command
CMD ["python3", "app.py"]

i thought it might have to do with the app being a bit too big for dyno=1 and that i'd have to pay to increase the dynos?我认为这可能与应用程序对于 dyno=1 来说有点太大有关,而且我必须付费才能增加 dynos? but I'm not sure..但我不确定..

thanks in advance!!提前致谢!!

The application cannot bind to the Heroku port, nothing to do with the Dyno.应用程序无法绑定到 Heroku 端口,与 Dyno 无关。 Try to cast to int the port before assigning it尝试在分配端口之前强制转换为 int

 port = int(os.environ.get("PORT", 5000))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM