Python Gunicorn Worker 由于参数不正确而退出?

Mat*_*age 1 python virtualenv gunicorn

我正在设置一台新服务器,作为该过程的一部分,我设置了 Gunicorn 来提供 Web 文件服务。但是,传输数据时,在旧服务器上有效的命令在该服务器上不起作用。

Gunicorn master 进程似乎启动了工作进程,但工作进程由于“无法识别的参数”而立即退出。命令是:/home/postgres/venv/bin/gunicorn [app]:app。这与之前的服务器相同,只是该服务器使用 virtualenv 而不是全局包。我怀疑这可能是问题所在,但我不确定为什么或如何解决它。

相同的Python版本,但gunicorn版本较新(旧版为19.4.5,新版为19.9.0)。

我已将应用程序名称替换为 [app] 以防止混淆,但名称中没有无效字符或任何内容。

日志:

root@ns500738:/home/postgres/[app]# /home/postgres/venv/bin/gunicorn [app]:app
[2018-07-18 13:27:56 -0400] [10080] [INFO] Starting gunicorn 19.9.0
[2018-07-18 13:27:56 -0400] [10080] [INFO] Listening at: http://127.0.0.1:8000 (10080)
[2018-07-18 13:27:56 -0400] [10080] [INFO] Using worker: sync
[2018-07-18 13:27:56 -0400] [10083] [INFO] Booting worker with pid: 10083
usage: gunicorn [-h] [-c]
gunicorn: error: unrecognized arguments: [app]:app
[2018-07-18 13:27:56 -0400] [10083] [INFO] Worker exiting (pid: 10083)
[2018-07-18 13:27:56 -0400] [10085] [INFO] Booting worker with pid: 10085
usage: gunicorn [-h] [-c]
gunicorn: error: unrecognized arguments: [app]:app
[2018-07-18 13:27:57 -0400] [10085] [INFO] Worker exiting (pid: 10085)
[2018-07-18 13:27:57 -0400] [10087] [INFO] Booting worker with pid: 10087
usage: gunicorn [-h] [-c]
gunicorn: error: unrecognized arguments: [app]:app
[2018-07-18 13:27:57 -0400] [10087] [INFO] Worker exiting (pid: 10087)
^C[2018-07-18 13:27:57 -0400] [10080] [INFO] Handling signal: int
[2018-07-18 13:27:57 -0400] [10080] [INFO] Shutting down: Master
Run Code Online (Sandbox Code Playgroud)

Mat*_*age 5

我已经想通了。

我最近argparse在脚本中添加了参数解析,这导致它捕获要传递给gunicorn 的参数。

如果我删除 argparse 部分,它会再次工作。