gunicorn部署flask项目命令

1、在没有gunicorn配置文件的时候启动flask项目    $ gunicorn -w 2 -b 127.0.0.1:8000 test:app(2代表启动2个进程,127.0.0.1:8000指绑定本机ip和端口号,test指flask的程序名字,app是flask程序里面的实例)      

gunicorn get_price_api:server -w 4 -b 127.0.0.1:3652 --pid /data/flask/task/spider_one/log/gunicorn.pid --access-logfile /data/flask/task/spider_one/log/flaskaccess.log

2、在有gunicorn配置文件的时候启动flask项目        $ gunicorn -c gconfig.py test:app(gconfig.py指gunicorn的配置文件,test指flask的程序名字,app是flask程序里面的实例)

3、查看gunicorn的运行pid号    pstree -ap|grep gunicorn

4、关闭gunicorn    kill -9 1234(gunicorn主线程号)

5、重启gunicorn     kill -HUP 1234

 

详情:https://www.jianshu.com/p/260f18aa5462

posted @ 2019-12-25 16:33  乔儿  阅读(1342)  评论(0编辑  收藏  举报