Files
team-tryouts/wsgi.py
T
GGThedandClaude Opus 5 7cec18c139 style: formater le depot avec ruff format
QUA-002, premiere moitie. **Ce commit ne fait que reformater** : aucun
changement de comportement, aucune ligne de logique touchee. 72 fichiers,
4 restaient deja conformes. Il est isole exprès, pour que `git log -p` sur
les commits voisins reste lisible.

`quote-style = "preserve"` etait deja pose dans pyproject.toml, ce qui
evite le brassage guillemets simples / doubles : le diff porte sur les
retours a la ligne, l indentation des appels longs et les virgules
finales, pas sur le style de chaine.

Verification : 263 tests passent avant et apres, ruff check propre.

L activation en CI arrive dans le commit suivant, separement, pour que ce
diff-ci ne contienne rien d autre.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-08 15:53:10 -04:00

43 lines
1.3 KiB
Python

"""WSGI entry point for the Team Tryouts application.
This module provides the production WSGI server using Waitress (Windows).
Use this file to start the application in production instead of Flask's
built-in development server.
Usage:
python wsgi.py
Configuration via environment variables:
PORT: Port to listen on (default: 5000)
WAITRESS_THREADS: Number of worker threads (default: CPU*2+1)
"""
import os
import multiprocessing
from app.app import create_app
app = create_app()
if __name__ == '__main__':
from waitress import serve
port = int(os.getenv('PORT', 10000))
threads = int(os.getenv('WAITRESS_THREADS', multiprocessing.cpu_count() * 2 + 1))
host = os.getenv('HOST', '0.0.0.0') # Bind to localhost by default (Nginx reverse proxy)
print(f'Starting Waitress server on {host}:{port} with {threads} threads')
serve(
app,
host=host,
port=port,
threads=threads,
# Graceful shutdown settings
channel_timeout=30, # Seconds to wait for in-flight requests
cleanup_interval=30,
# Waitress Proxy Settings
trusted_proxy='*',
trusted_proxy_count=1,
trusted_proxy_headers={'x-forwarded-for', 'x-forwarded-proto'},
clear_untrusted_proxy_headers=True,
)