File size: 1,465 Bytes
51b84b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
"""
Supply Roster Optimization Tool - Main Entry Point
Run this file to start the Streamlit application
"""

import sys
import os
import subprocess

def main():
    """Main entry point for the Supply Roster Optimization Tool"""
    
    # Get the directory where this script is located
    project_root = os.path.dirname(os.path.abspath(__file__))
    
    # Add project root to Python path
    sys.path.insert(0, project_root)
    
    # Path to the Streamlit app
    app_path = os.path.join(project_root, 'ui', 'app.py')
    
    # Check if the app file exists
    if not os.path.exists(app_path):
        print(f"❌ Error: Could not find app.py at {app_path}")
        print("Please ensure the project structure is correct.")
        sys.exit(1)
    
    print("πŸš€ Starting Supply Roster Optimization Tool...")
    print(f"πŸ“ Project root: {project_root}")
    print(f"🎯 App path: {app_path}")
    print("🌐 Opening in browser...")
    
    # Run Streamlit
    try:
        subprocess.run([
            sys.executable, '-m', 'streamlit', 'run', app_path,
            '--server.headless', 'false',
            '--server.address', 'localhost',
            '--server.port', '8501'
        ], cwd=project_root)
    except KeyboardInterrupt:
        print("\nπŸ‘‹ Application stopped by user")
    except Exception as e:
        print(f"❌ Error starting application: {e}")
        sys.exit(1)

if __name__ == "__main__":
    main()