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 启动;
你要是觉得写的还不错,就点个关注,可以评论区留下足迹,以后方便查看.
你要是觉得写的很辣鸡,评论区欢迎来对线!
欢迎转载!