Gunicorn配置文件

Gunicorn

  • 运行命令

    gunicorn -c gunicorn配置文件(需要加后缀) wsgi路径(不要要后缀)

  • 配置文件

 1 # -*- coding: utf-8 -*-
 2 from multiprocessing import cpu_count
 3 bind = ["127.0.0.1:9000"]  # 线上环境不会开启在公网 IP 下,一般使用内网 IP
 4 daemon = True  # 是否开启守护进程模式
 5 pidfile = 'logs/gunicorn.pid' #保存gunicorn的进程pid的文件
 6 
 7 workers = 4 # cpu_count() * 2 # 工作进程数量
 8 # worker_class = "gevent"  # 指定一个异步处理的库
 9 worker_class = "egg:meinheld#gunicorn_worker"  # 比 gevent 更快的一个异步网络库
10 worker_connections = 65535  # 单个进程的最大连接数
11 
12 keepalive = 60  # 服务器保持连接的时间,能够避免频繁的三次握手过程
13 timeout = 30 # 一个请求的超时时间
14 graceful_timeout = 10 # 重启时限
15 forwarded_allow_ips = '*' # 允许哪些ip地址来访问
16 
17 # 日志处理
18 capture_output = True # 是否捕获输出
19 loglevel = 'info' # 日志级别
20 errorlog = 'logs/error.log' # 错误日志存储路径

 

 

 

 

 

 

posted @ 2020-06-10 15:00  JustInTime  阅读(1373)  评论(0)    收藏  举报