Fix uvicorn logging for PyInstaller, update gitignore

This commit is contained in:
2026-01-31 14:37:45 +02:00
parent fa55fec94a
commit b62e893abe
2 changed files with 23 additions and 2 deletions

View File

@@ -4,8 +4,14 @@ import sys
# Set base path for PyInstaller
if getattr(sys, 'frozen', False):
# Running as compiled
os.chdir(os.path.dirname(sys.executable))
# Fix uvicorn TTY detection — sys.stdin/stdout/stderr are None when frozen
if sys.stdin is None:
sys.stdin = open(os.devnull, 'r')
if sys.stdout is None:
sys.stdout = open(os.devnull, 'w')
if sys.stderr is None:
sys.stderr = open(os.devnull, 'w')
import uvicorn
from app.main import app
@@ -18,5 +24,6 @@ if __name__ == '__main__':
app,
host=host,
port=port,
log_level='info',
log_level='warning',
access_log=False,
)