Modify: default gunicorn config values

This commit is contained in:
Stepan Zhukovsky 2023-09-01 16:53:54 +09:00
parent ebf8c83bc4
commit 40a07bf78d

View File

@ -9,19 +9,17 @@ from logs_collector.settings import BASE_DIR
# https://docs.gunicorn.org/en/stable/settings.html # https://docs.gunicorn.org/en/stable/settings.html
# https://github.com/benoitc/gunicorn/blob/master/examples/example_config.py # https://github.com/benoitc/gunicorn/blob/master/examples/example_config.py
# hide web server name:
gunicorn.SERVER = 'undisclosed'
env = environ.Env( env = environ.Env(
# set casting, default value: # set casting, default value:
GUNICORN_SERVER_NAME=(str, 'undisclosed'),
GUNICORN_BIND=(str, '0.0.0.0:8000'), GUNICORN_BIND=(str, '0.0.0.0:8000'),
GUNICORN_BACKLOG=(int, 2048), GUNICORN_BACKLOG=(int, 2048),
GUNICORN_WORKERS=(int, 2), GUNICORN_WORKERS=(int, 2),
GUNICORN_WORKER_CLASS=(str, 'gthread'), GUNICORN_WORKER_CLASS=(str, 'sync'),
GUNICORN_WORKER_CONNECTIONS=(int, 1000), GUNICORN_WORKER_CONNECTIONS=(int, 1000),
GUNICORN_THREADS=(int, 1), GUNICORN_THREADS=(int, 2),
GUNICORN_TIMEOUT=(int, 30), GUNICORN_TIMEOUT=(int, 3600),
GUNICORN_KEEPALIVE=(int, 2), GUNICORN_KEEPALIVE=(int, 2),
GUNICORN_LOGLEVEL=(str, 'info'), GUNICORN_LOGLEVEL=(str, 'info'),
@ -29,6 +27,9 @@ env = environ.Env(
environ.Env.read_env(BASE_DIR / '.env') environ.Env.read_env(BASE_DIR / '.env')
# Server name:
gunicorn.SERVER = env('GUNICORN_SERVER_NAME')
# Server socket: # Server socket:
bind = env('GUNICORN_BIND') bind = env('GUNICORN_BIND')
backlog = env('GUNICORN_BACKLOG') backlog = env('GUNICORN_BACKLOG')
@ -45,4 +46,4 @@ keepalive = env('GUNICORN_KEEPALIVE')
loglevel = env('GUNICORN_LOGLEVEL') loglevel = env('GUNICORN_LOGLEVEL')
errorlog = '-' errorlog = '-'
accesslog = '-' accesslog = '-'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' # noqa:E501 access_log_format = '%({X-Forwarded-For}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' # noqa:E501