- 在你的服务安装(pip install gunicorn gevent)
- gunicorn -w 3 -b 0.0.0.0:8888 run
- 在你主目录建立一个gunicorn-config.py文件,文件名可以随便起
- 编写gunicorn-config.py,新建logs文件夹
注意:下面代码bind = [“127.0.0.1:9999”]在nginx反向代理的时候会用到,必须一致,为什么建立logs文件夹?用来存日志,细心的同学会发现,pidfile ,errorlog 中用到,他不像uwsgi会自动创建,需要手动创建
from multiprocessing import cpu_count
bind = ["127.0.0.1:9999"] # 线上环境不会开启在公网 IP 下,一般使用内网 IP
daemon =