gunicorn配置

gunicorn配置


1 配置 gunicorn 文件

支持 ini , py 配置文件 支持写成独立的 app 启动

启动命令:

`gunicorn project.wsgi:application -conf/gunicorn.conf.py`

// 项目下的 wsgi:application  指定 配置文件

gunicorn.conf.py 文件


bind = "10.0.0.206:8188"

workers = 2

threads = 4

max_requests = 1000

reload = True

accesslog = '/home/jiamin/jiamintest/logs/gunicorn_access.log'

access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'

loglevel =  'info'

proc_name = 'project'

chdir = '/home/jiamin/jiamintest/project/middle_server'

#  切换当前的路径 


def on_starting(server):
    print("ojbk")

# 钩子函数, 启动前执行


Buy me a 肥仔水!