2

我有以下过程文件:

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 的 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)"
4

1 回答 1

3

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

=> 试试这个:

gunicorn --config python:gunicorn_config application:app 
于 2017-01-31T15:07:43.350 回答