"""
gunicorn wsgi服务配置文件
"""
import os
import logging
import logging.handlers
from logging.handlers import WatchedFileHandler
import multiprocessing
# 应用绑定的IP和端口
bind = 'YOUR_IP:10050'
# 设置超时时间
timeout = '30'
# 设置日志目录
if not os.path.exists('log/'):
os.makedirs('log/')
loglevel = 'debug'
# 设置日志格式,错误日志不能设置
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
"""
其每个选项的含义如下:
h remote address
l '-'
u currently '-', may be user name in future releases
t date of the request
r status line (e.g. ``GET / HTTP/1.1``)
s status
b response length or '-'
f referer
a user agent
T request time in seconds
D request time in microseconds
L request time in decimal seconds
p process ID
"""
errorlog = 'log/error.log'
accesslog = 'log/access.log'
pidfile = 'log/gunicorn.pid'
# 设置工作模式 默认sync模式,设置为gevent模式
worker_class = 'gevent'
# 设置工作(worker)进程数 推荐值: CPU数量 * 2 + 1
workers = multiprocessing.cpu_count() * 2 + 1
# 最大连接数
worker_connections = 1000
# 是否守护进程运行, 如果启动时候存在问题,把值调整为False,在启动控制台看错误信息,调整错误配置后把值调整为True
daemon = True
# 进程名
proc_name = 'yunzhu_ddi_gunicorn.proc'
# 持久连接秒数
keeplive = 3
# python环境路径
pythonpath = '/root/yunzhu/dingwei-draw-image/venv/bin/python3'
# 等待连接最大数量
backlog = 2048