<h1>可以将gunicorn 配置单独隔离成py文件
eg:
<h5>gunicorn.py
workers = 4
bind = "127.0.0.1:8086"
backlog = 2048
timeout = 60
keepalive = 2
#errorlog = '_error.log'
loglevel = 'info'
#accesslog = '_access.log'
worker_class = 'gevent'
worker_connections = 1000
threads = 2
gunicorn配置:
[group:blog_group]
programs=blog
[program:blog_group]
command=/home/blog_group/env/bin/python /home/blog_group/env/bin/gunicorn -c gunicorn.py blog.wsgi:application
directory=/home/blog_group
user=root
autorestart=true
redirect_stderr=true
stdout_logfile_maxbytes = 100MB
stdout_logfile_backups = 10
stdout_logfile=/var/log/supervisor/blog_group.log
loglevel=error
startsecs=10
<h1>命令行参数
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-c FILE, --config=FILE
The path to a Gunicorn config file. [None]
--debug Turn on debugging in the server. [False]
--spew Install a trace function that spews every line
executed by the server. [False]
--access-logfile=FILE
The Access log file to write to. [None]
--access-logformat=STRING
The Access log format . [%(h)s %(l)s %(u)s %(t)s
"%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"]
--error-logfile=FILE, --log-file=FILE
The Error log file to write to. [-]
--log-level=LEVEL The granularity of Error log outputs. [info]
--logger-class=STRING
The logger you want to use to log events in gunicorn.
[simple]
-n STRING, --name=STRING
A base to use with setproctitle for process naming.
[None]
--preload Load application code before the worker processes are
forked. [False]
-D, --daemon Daemonize the Gunicorn process. [False]
-p FILE, --pid=FILE A filename to use for the PID file. [None]
-u USER, --user=USER Switch worker processes to run as this user. [1000]
-g GROUP, --group=GROUP
Switch worker process to run as this group. [1000]
-m INT, --umask=INT A bit mask for the file mode on files written by
Gunicorn. [0]
-b ADDRESS, --bind=ADDRESS
The socket to bind. [127.0.0.1:8000]
--backlog=INT The maximum number of pending connections. [2048]
-w INT, --workers=INT
The number of worker process for handling requests.
[1]
-k STRING, --worker-class=STRING
The type of workers to use. [sync]
--worker-connections=INT
The maximum number of simultaneous clients. [1000]
--max-requests=INT The maximum number of requests a worker will process
before restarting. [0]
-t INT, --timeout=INT
Workers silent for more than this many seconds are
killed and restarted. [30]
--keep-alive=INT The number of seconds to wait for requests on a Keep-
Alive connection. [2]