diff --git a/start_app.py b/start_app.py index b853a3c..4c234ae 100755 --- a/start_app.py +++ b/start_app.py @@ -60,14 +60,35 @@ def main(): return False print() - # Verify app.py exists - print("[3/4] Verifying application files...") - app_path = os.path.join(os.path.dirname(__file__), "app.py") + # Find the app directory (handle symlinks and copies) + print("[3/4] Locating application directory...") + + # Start with script location + script_dir = os.path.dirname(os.path.abspath(__file__)) + + # Resolve symlinks + if os.path.islink(__file__): + script_dir = os.path.dirname(os.path.abspath(os.readlink(__file__))) + + app_path = os.path.join(script_dir, "app.py") + + # If app.py not found, search for it if not os.path.exists(app_path): - print(f"ERROR: app.py not found at {app_path}") - input("Press Enter to exit...") - return False - print("✓ Application found: app.py\n") + print(f" Searching for app.py near {script_dir}...") + + # Check parent directory + parent_dir = os.path.dirname(script_dir) + app_path = os.path.join(parent_dir, "app.py") + if os.path.exists(app_path): + script_dir = parent_dir + else: + print(f"ERROR: app.py not found") + print(f" Checked: {script_dir}") + print(f" Checked: {parent_dir}") + input("Press Enter to exit...") + return False + + print(f"✓ Application found: {app_path}\n") # Start the app print("[4/4] Starting web application...\n") @@ -86,7 +107,7 @@ def main(): pass # Change to app directory and run - os.chdir(os.path.dirname(__file__)) + os.chdir(script_dir) try: # Import and run the Flask app