Tech Stack Advisor - Code Viewer

← Back to File Tree

run_streamlit.py

Language: python | Path: run_streamlit.py | Lines: 19
#!/usr/bin/env python3
"""Launcher script for Streamlit that properly reads Railway's PORT variable."""
import os
import sys

# Get port from environment, default to 8501 for local dev
port = os.environ.get("PORT", "8501")

print(f"Starting Streamlit on port {port}")

# Use os.execvp to replace this process with streamlit
# This ensures streamlit runs as PID 1 and handles signals properly
os.execvp("streamlit", [
    "streamlit",
    "run",
    "frontend/streamlit_app.py",
    f"--server.port={port}",
    "--server.address=0.0.0.0",
])