gunicorn配置

 

 

import logging
import logging.handlers
from logging.handlers import WatchedFileHandler
import os
import multiprocessing
import sys

path_of_current_file = os.path.abspath(__file__)
print(path_of_current_file)
path_of_current_dir = os.path.split(path_of_current_file)[0]
_file_name = os.path.basename(__file__)
sys.path.insert(0, path_of_current_dir)

bind = "10.88.158.57:8001"  # 绑定的ip与端口
backlog = 512  # 监听队列数量,64-2048
chdir = '/home/tkamc/lwh/projects/web/quality_check_page/'  # gunicorn要切换到的目的工作目录
worker_class = 'sync'  # 使用gevent模式,还可以使用sync 模式,默认的是sync模式
workers = multiprocessing.cpu_count() * 2 + 1  # 进程数
threads = multiprocessing.cpu_count() * 4  # 指定每个进程开启的线程数
loglevel = 'debug'  # 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置

# reload=True
# debug=False
pidfile = '%s/run/operation.pid' % (path_of_current_dir)
errorlog = '%s/logs/debug.log' % (path_of_current_dir)
accesslog = '%s/logs/access.log' % (path_of_current_dir)

# access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
# accesslog ='/home/tkamc/django_web_project/django_socket/gunicorn_access.log'      #访问日志文件
# errorlog ='/home/tkamc/django_web_project/django_socket/gunicorn_error.log'        #错误日志文件
# accesslog = "/home/tkamc/django_web_project/django_socket/gunicorn_access.log"  #访问日志文件,"-" 表示标准输出
# errorlog = "/home/tkamc/django_web_project/django_socket/gunicorn_error.log"   #错误日志文件,"-" 表示标准输出

proc_name = 'fof_api'  # 进程名

 

posted @ 2020-09-11 10:04  清风扶山岗  阅读(288)  评论(0)    收藏  举报