【发布时间】:2017-10-24 08:55:13
【问题描述】:
我用supervisor管理的gunicorn会自动退出。这是我用Python3搭建的Flask项目。希望得到你的帮助。 启动命令为:
sudo supervisord -c /etc/supervisor/conf.d/app.conf
日志:
[2017-10-24 08:41:15 +0000] [10357] [INFO] Starting gunicorn 19.7.1
[2017-10-24 08:41:15 +0000] [10357] [INFO] Listening at: http://0.0.0.0:8000 (10357)
[2017-10-24 08:41:15 +0000] [10357] [INFO] Using worker: sync
[2017-10-24 08:41:15 +0000] [10360] [INFO] Booting worker with pid: 10360
[2017-10-24 08:41:16 +0000] [10362] [INFO] Booting worker with pid: 10362
[2017-10-24 08:41:16 +0000] [10364] [INFO] Booting worker with pid: 10364
[2017-10-24 08:41:16 +0000] [10366] [INFO] Booting worker with pid: 10366
[2017-10-24 08:41:54 +0000] [10357] [INFO] Handling signal: term
[2017-10-24 08:41:54 +0000] [10360] [INFO] Worker exiting (pid: 10360)
[2017-10-24 08:41:54 +0000] [10362] [INFO] Worker exiting (pid: 10362)
[2017-10-24 08:41:54 +0000] [10366] [INFO] Worker exiting (pid: 10366)
[2017-10-24 08:41:54 +0000] [10364] [INFO] Worker exiting (pid: 10364)
[2017-10-24 08:41:54 +0000] [10357] [INFO] Shutting down: Master
主管配置:
[program:app]
directory = /home/ubuntu/Flask-Blog/
command = /home/ubuntu/Flask-Blog/venv/bin/gunicorn -w4 -b0.0.0.0:8000 manage:app
autostart = true
startsecs = 5
autorestart = true
startretries = 3
user = ubuntu
redirect_stderr = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups = 20
stdout_logfile = /home/ubuntu/Flask-Blog/log/gunicorn.log
stder_logfile = /home/ubuntu/Flask-Blog/log/gunicorn.err
stopasgroup = false
killasgroup = false
[supervisorctl]
[supervisord]
[inet_http_server]
port = 127.0.0.1:9001
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
【问题讨论】:
-
重复的路由端点/逻辑错误可能会导致这种情况发生。在没有 gunicorn 的情况下运行您的应用并确认应用没有产生此错误
-
我使用相同的命令启动了 gunicorn,但没有发生。
-
我的意思是在没有 gunicorn 的情况下运行烧瓶应用程序。看到这个:flask.pocoo.org/docs/0.12/quickstart/#debug-mode
-
我在没有gunicorn的情况下运行flask app,没有报错
标签: python python-3.x flask gunicorn supervisord