gpt4 book ai didi

heroku - 在 heroku docker 中运行 gunicorn

转载 作者:行者123 更新时间:2023-12-02 18:16:59 24 4
gpt4 key购买 nike

我有以下过程文件:

web: gunicorn application:app --config=gunicorn_config.py

当我使用 foreman start 运行它时一切正常,但是当我使用 docker-compose up web 在容器内运行它时,我得到
web_1        | usage: gunicorn [OPTIONS] [APP_MODULE]
web_1 | gunicorn: error: No application module specified.

我用来构建容器的过程在 Heroku's docker guide 中指定。 :
1. `heroku docker:init` to set up Dockerfile and docker compose configuration.
2. `docker-compose build` to create the image.
3. I always do a restart of my vm for good measure: `docker-machine restart default && eval "$(docker-machine env default)"

最佳答案

正如您在 gunicorn 错误消息中看到的那样,您应该在 --config 选项之后编写应用程序模块。您还需要指定配置模块(即不带 .py)并指定它是 python。

=> 试试这个:

gunicorn --config python:gunicorn_config application:app 

关于heroku - 在 heroku docker 中运行 gunicorn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32827323/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com