pip install gunicore
gunicore启动web服务
gunicorn --worker=3 main:app -b 127.0.0.1:5000
gunicorn -w4 -b0.0.0.0:8000 myproject:app
进入项目启动配置文件,用supervisor启动,不用gunicore了
supervisorctl -c supervisor.conf
supervisor配置文件配置:
[program:lianxi]
command=/Users/cheng/workspace/lianxi/bin/gunicorn -w 4 -b 0.0.0.0:8000 myapp:app
directory=/Users/cheng/workspace/lianxi/lianxi/myproject
;startsecs=0
;stopwaitsecs=0
autostart=true
autorestart=true
;user=cheng
stdout_logfile=/Users/cheng/workspace/lianxi/log/gunicorn.log
stderr_logfile=/Users/cheng/workspace/lianxi/log/gunicorn.err
shift+g移动到下一行
用gunicorn执行web项目
/Users/cheng/workspace/lianxi/bin/gunicorn -w 4 -b 0.0.0.0:8000 myapp:app
日志文件在/tem/下的内容
netstat -na | grep 8000 查看端口占用情况
ps aux | grep supervisor
ps -ef | grep supervisor