1、pip3 install gunicorn
2、编写配置文件:guni.py
import logging
import logging.handlers
import os
import multiprocessing
import gevent.monkey
gevent.monkey.patch_all()
bind = '0.0.0.0:*000'
chdir = '/home/work/'
timeout = 60
workers = 2
worker_class = 'gevent' # eventlet,gevent,tornado,gthread,gaiohttp;default sync;
# workers = multiprocessing.cpu_count() * 2 + 1
loglevel = "info"
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
pidfile = "gunicorn.pid"
accesslog = "access.log"
errorlog = "error.log"
daemon = True
3、运行,(其中index是注册flask的蓝图的app文件)
gunicorn -c guni.py index:app