rkihacker commited on
Commit
b440e00
·
verified ·
1 Parent(s): 56d0fcf

Create gunicorn_conf.py

Browse files
Files changed (1) hide show
  1. gunicorn_conf.py +24 -0
gunicorn_conf.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ # General recommendation: (2 * number_of_cores) + 1
4
+ # For your 2vCPU machine, 5 is a good starting point.
5
+ workers = int(os.environ.get('GUNICORN_PROCESSES', '5'))
6
+
7
+ # Use the Uvicorn worker class for asyncio compatibility
8
+ worker_class = "uvicorn.workers.UvicornWorker"
9
+
10
+ # The address and port to bind to
11
+ bind = "0.0.0.0:8000"
12
+
13
+ # Set log levels
14
+ loglevel = "info"
15
+ accesslog = "-" # Log access to stdout
16
+ errorlog = "-" # Log errors to stderr
17
+
18
+ # --- CRUCIAL CHANGE ---
19
+ # Set worker timeout to 0 to disable it completely.
20
+ # This prevents Gunicorn from killing workers during long-running streams.
21
+ timeout = 0
22
+
23
+ # Timeout for gracefully restarting a worker (still useful for deployments)
24
+ graceful_timeout = 60