gunicorn简单配置

Gunicorn配置


# -*- coding: utf-8 -*-
import os
from multiprocessing import cpu_count

bind = "127.0.0.1:9000"
daemon = True

workers = cpu_count() * 2
worker_class = "gevent"
forwarded_allow_ips = '*'

keepalive = 6
timeout = 65
graceful_timeout = 10
worker_connections = 65535
loglevel = 'error'  # 日志级别,这个日志级别指的是错误日志的级别,而访问日志的级别无法设置
# access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'    #设置gunicorn访问日志格式,错误日志无法设置
# accesslog = "/root/boke/Blog/log/gunicorn_access.log"      #访问日志文件
errorlog = "/root/www/logs/gunicorn_error.log"  # 错误日志文件

启动

gunicorn -c gunicorn.conf.py manage:application

启动命令解释

manage是启动的入口脚本:manage.py;application 是app的名字;-c 指定以gunicorn.cong.py 启动;

posted @ 2020-12-09 14:17  rm-rf*  阅读(177)  评论(0编辑  收藏  举报