gunicorn.conf.py 608 B

123456789101112131415161718192021222324252627
  1. import time
  2. import os
  3. bind = '0.0.0.0:8348'
  4. workers = os.environ.get("WORKERS", "2")
  5. timeout = os.environ.get("TIMEOUT", "180")
  6. preload_app = True
  7. enable_stdio_inheritance = True
  8. loglevel = 'info'
  9. accesslog = '-'
  10. pidfile = "app.pid"
  11. keyfile = None
  12. certfile = None
  13. worker_class = 'gthread'
  14. threads = 4
  15. ca_certs = None
  16. def on_starting(server):
  17. worker_count = int(workers)
  18. # Insert a 1-second gap between workers
  19. gap_duration = 1
  20. for i in range(worker_count):
  21. # Add a delay between each worker
  22. time.sleep(gap_duration)
  23. print(f"Starting worker {i + 1}/{worker_count}")