30 lines
767 B
Python
30 lines
767 B
Python
"""Entry point for PyInstaller bundle"""
|
|
import os
|
|
import sys
|
|
|
|
# Set base path for PyInstaller
|
|
if getattr(sys, 'frozen', False):
|
|
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
|
|
|
|
if __name__ == '__main__':
|
|
host = os.environ.get('RFCP_HOST', '127.0.0.1')
|
|
port = int(os.environ.get('RFCP_PORT', '8888'))
|
|
|
|
uvicorn.run(
|
|
app,
|
|
host=host,
|
|
port=port,
|
|
log_level='warning',
|
|
access_log=False,
|
|
)
|