命令行模式
gunicorn -w 4 -b 0.0.0.0:8000 --access-logfile access.log --error-logfile error.log loglevel debug
配置文件 gunicorn.conf
# gunicorn.conf
# 并行工作进程数
workers = 4
# 指定每个工作者的线程数
threads = 2
# 监听内网端口5000
bind = '127.0.0.1:5000'
# 设置守护进程,将进程交给supervisor管理
daemon = 'false'
# 工作模式协程
worker_class = 'gevent'
# 设置最大并发量
worker_connections = 2000
# 设置进程文件目录
pidfile = '/var/run/gunicorn.pid'
# 设置访问日志和错误信息日志路径
accesslog = '/var/log/gunicorn_acess.log'
errorlog = '/var/log/gunicorn_error.log'
# 设置日志记录水平
loglevel = 'warning'
配置文件启动
gunicorn -c gunicorn.conf app:app
``
标签:设置,gunicorn,conf,var,日志,log
From: https://www.cnblogs.com/guanchaoguo/p/18406618