最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【未解决】把gunicorn从19.6降级为18.0后supervisorctl运行出错:gunicorn: error: No application module specified

Flask crifan 5059浏览 0评论

折腾:

【未解决】Flask-SocketIO测试出错:POST socket.io EIO 400 BAD REQUEST

期间,把gunicorn从最新版本19.6

pip uninstall gunicorn

Uninstalling gunicorn-19.6.0

pip install gunicorn==18.0

然后去运行之前可以正常运行的supervisorctl但是出错了:

(RunningFast) ➜  staging supervisorctl -c supervisor.conf restart runningfast_staging
runningfast_staging: ERROR (not running)
runningfast_staging: started

去看log是:

usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: No application module specified.

对应的配置是:

(RunningFast) ➜  staging cat supervisor.conf 
[program:runningfast_stable]
directory=/root/RunningFast/stable
command=/root/Envs/RunningFast/bin/gunicorn -w 1 -b 0.0.0.0:21084 run:app &
startsecs=0
stopwaitsecs=0
autostart=false
autorestart=false
stdout_logfile_maxbytes=1MB
stderr_logfile_maxbytes=1MB
stdout_logfile=/root/RunningFast/stable/logs/gunicorn.log
stderr_logfile=/root/RunningFast/stable/logs/gunicorn.err
[program:runningfast_staging]
directory=/root/RunningFast/staging
command=/root/Envs/RunningFast/bin/gunicorn -w 1 -b 0.0.0.0:21085 run:app &
startsecs=0
stopwaitsecs=0
autostart=false
autorestart=false
stdout_logfile_maxbytes=1MB
stderr_logfile_maxbytes=1MB
stdout_logfile=/root/RunningFast/staging/logs/gunicorn.log
stderr_logfile=/root/RunningFast/staging/logs/gunicorn.err

但是单独运行却可以:

(RunningFast) ➜  staging netstat -tupln | grep python
tcp        0      0 127.0.0.1:8080              0.0.0.0:*                   LISTEN      24318/python        
tcp        0      0 127.0.0.1:21084             0.0.0.0:*                   LISTEN      2910/python         
tcp        0      0 127.0.0.1:21085             0.0.0.0:*                   LISTEN      3536/python         
(RunningFast) ➜  staging kill -9 3536
[2]  + 3536 killed     gunicorn -w 1 -b 127.0.0.1:21085 run:app                                                                                                                           
(RunningFast) ➜  staging 2016-10-28 21:04:00 [3545] [INFO] Parent changed, shutting down: <Worker 3545>
2016-10-28 21:04:00 [3545] [INFO] Worker exiting (pid: 3545)
(RunningFast) ➜  staging gunicorn -w 1 -b 0.0.0.0:21085 run:app &
[2] 3762
(RunningFast) ➜  staging 2016-10-28 21:04:13 [3762] [INFO] Starting gunicorn 18.0
2016-10-28 21:04:13 [3762] [INFO] Listening at: http://0.0.0.0:21085 (3762)
2016-10-28 21:04:13 [3762] [INFO] Using worker: sync
2016-10-28 21:04:13 [3771] [INFO] Booting worker with pid: 3771
Server initialized for gevent.

<div–<——————————————————————————

DEBUG in app [/root/RunningFast/staging/runningfast/app.py:82]:
app=<Flask ‘runningfast.app’>, api=<flask_restful.Api object at 0x7f1f18a9c0d0>, redis_store=<flask_redis.FlaskRedis object at 0x7f1f1740b850>, db=<SQLAlchemy engine=’mysql://runningfast:Jiandao123@localhost/runningfast_dev’>, server_mode=staging, server_type=develop, rq=<flask_rq2.app.RQ object at 0x7f1f18a9c510>, socketio=<flask_socketio.SocketIO object at 0x7f1f18a9c890>

<div–<——————————————————————————

<div–<——————————————————————————

DEBUG in app [/root/RunningFast/staging/runningfast/app.py:219]:
API_VERSION=1.0, API_URL_PREFIX=/runningfast/api/v1.0, OPEN_API_URL_PREFIX=/runningfast/api/v1.0/open

<div–<——————————————————————————

gunicorn 18 gunicorn: error: No application module specified

supervisorctl gunicorn: error: No application module specified

【总结】

对于:

之前用最新的19.6的gunicorn,supervisor可以通过配置:

supervisor.conf

中的:

command=/root/Envs/RunningFast/bin/gunicorn -w 1 -b 0.0.0.0:21085 run:app &

正常运行flask的app:

supervisorctl -c supervisor.conf restart runningfast_staging

但是换成旧版本18.0的gunicorn后,却无法正常用supervisord去运行flask的app了。

只能通过手动去运行:

gunicorn -w 1 -b 0.0.0.0:21085 run:app &

具体原因,未知,暂时也无法解决。

转载请注明:在路上 » 【未解决】把gunicorn从19.6降级为18.0后supervisorctl运行出错:gunicorn: error: No application module specified

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.158 seconds, using 22.24MB memory