37 lines
878 B
Python
37 lines
878 B
Python
"""Gunicorn configuration for YouTube Web Server."""
|
|
|
|
import os
|
|
|
|
# Server binding
|
|
bind = f"0.0.0.0:{os.environ.get('PORT', 4096)}"
|
|
|
|
# Worker configuration - use gthread for threading-based SocketIO
|
|
worker_class = "gthread"
|
|
workers = 1
|
|
|
|
# Thread configuration
|
|
threads = 4
|
|
|
|
# Timeout configuration
|
|
timeout = 120
|
|
graceful_timeout = 60
|
|
|
|
# Logging - use stdout/stderr in Docker, files locally
|
|
import os
|
|
|
|
if os.environ.get('DOCKER'):
|
|
accesslog = "-"
|
|
errorlog = "-"
|
|
loglevel = "info"
|
|
else:
|
|
log_dir = os.environ.get("GUNICORN_LOG_DIR", os.path.dirname(os.path.abspath(__file__)))
|
|
accesslog = os.path.join(log_dir, "gunicorn-access.log")
|
|
errorlog = os.path.join(log_dir, "gunicorn-error.log")
|
|
loglevel = "debug"
|
|
|
|
# Process naming
|
|
proc_name = "youtube-web-server"
|
|
|
|
# Preload app - disabled as it causes yt-dlp C extension issues after fork
|
|
preload_app = False
|