Fix uvicorn logging for PyInstaller, update gitignore
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user