gunicorn.conf.py 592 B

1234567891011121314151617181920212223242526
  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. def on_starting(server):
  16. worker_count = int(workers)
  17. # Insert a 1-second gap between workers
  18. gap_duration = 1
  19. for i in range(worker_count):
  20. # Add a delay between each worker
  21. time.sleep(gap_duration)
  22. print(f"Starting worker {i + 1}/{worker_count}")