gunicorn常用配置

<h1>可以將gunicorn 配置單獨(dú)隔離成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>命令行參數(shù)

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]
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom閱讀 3,214評(píng)論 0 3
  • pyspark.sql模塊 模塊上下文 Spark SQL和DataFrames的重要類(lèi): pyspark.sql...
    mpro閱讀 9,920評(píng)論 0 13
  • Introduction Django is a powerful web framework that can ...
    ???木?燚??閱讀 2,397評(píng)論 0 0
  • 英文文檔,一開(kāi)始我也是抗拒的,邊翻譯邊看,也就花費(fèi)了1個(gè)小時(shí)基本就閱讀過(guò)了,我的英文基礎(chǔ)其實(shí)很差。附上鏈接:鏈接:...
    lonecolonel閱讀 10,420評(píng)論 3 1
  • 諸葛亮出生于公元一百八十一年,逝于二百三十四年,字孔明,號(hào)臥龍,瑯琊陽(yáng)都,今山東沂南人,三國(guó)時(shí)期蜀漢丞相,杰出的政...
    戰(zhàn)神_b55c閱讀 308評(píng)論 0 2

友情鏈接更多精彩內(nèi)容