gunicorn_config.py 743 B

12345678910111213141516171819202122232425
  1. """Gunicorn configuration for DataOps Platform production."""
  2. import os
  3. bind = f"{os.environ.get('LISTEN_HOST', '0.0.0.0')}:{os.environ.get('LISTEN_PORT', '5500')}"
  4. workers = int(os.environ.get("GUNICORN_WORKERS", "4"))
  5. timeout = int(os.environ.get("GUNICORN_TIMEOUT", "120"))
  6. capture_output = True
  7. enable_stdio_inheritance = True
  8. loglevel = "info"
  9. def post_worker_init(worker):
  10. """Re-apply Flask file logging after Gunicorn worker initialization."""
  11. del worker
  12. try:
  13. from wsgi import application
  14. from app import configure_logging
  15. configure_logging(application)
  16. except Exception as exc:
  17. import sys
  18. print(f"[gunicorn] post_worker_init logging setup failed: {exc}", file=sys.stderr)