#!/usr/bin/env python3 """ Run ScriptsManager application """ import sys import os from pathlib import Path # Add the project root to the Python path project_root = Path(__file__).parent.parent sys.path.insert(0, str(project_root)) from app.app import create_app, register_routes def run_app(): """Run the Flask application""" app = create_app() # Register all routes and get socketio instance socketio = register_routes(app) # Get port from environment, default to 5002 for production, 5003 for development port = int(os.environ.get('PORT', 5003 if os.environ.get('DEBUG') == 'true' else 5002)) debug = os.environ.get('DEBUG', 'false').lower() == 'true' # Run with SocketIO support socketio.run(app, host="0.0.0.0", port=port, debug=debug) if __name__ == "__main__": port = int(os.environ.get('PORT', 5003 if os.environ.get('DEBUG') == 'true' else 5002)) print("Starting ScriptsManager...") print(f"🚀 Application will be available at: http://localhost:{port}") print("🔄 HOT-RELOAD ENABLED - Modify files and they will update automatically!") print("Press Ctrl+C to stop the server") print("-" * 50) run_app()