Skip to content

Commit

Permalink
Update gunicorn config
Browse files Browse the repository at this point in the history
  • Loading branch information
olzhasar-reef committed Oct 24, 2024
1 parent b792b94 commit 34d1463
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions {{cookiecutter.repostory_name}}/app/envs/prod/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import multiprocessing
{% if cookiecutter.monitoring == "y" %}

import environ
{%- if cookiecutter.monitoring == "y" %}
from prometheus_client import multiprocess
{% endif %}
workers = 2 * multiprocessing.cpu_count() + 1
env = environ.Env()

workers = env.int("GUNICORN_WORKERS", 2 * multiprocessing.cpu_count() + 1)
max_workers = env.int("GUNICORN_MAX_WORKERS", 0)
if max_workers > 0:
workers = min(max_workers, workers)
threads = env.int("GUNICORN_THREADS", 1)
preload_app = env.bool("GUNICORN_PRELOAD_APP", True)
bind = "0.0.0.0:8000"
{%- if cookiecutter.use_channels == "y" %}
wsgi_app = "{{ cookiecutter.django_project_name }}.asgi:application"
Expand Down

0 comments on commit 34d1463

Please sign in to comment.