global search for app.py added
This commit is contained in:
+29
-8
@@ -60,14 +60,35 @@ def main():
|
|||||||
return False
|
return False
|
||||||
print()
|
print()
|
||||||
|
|
||||||
# Verify app.py exists
|
# Find the app directory (handle symlinks and copies)
|
||||||
print("[3/4] Verifying application files...")
|
print("[3/4] Locating application directory...")
|
||||||
app_path = os.path.join(os.path.dirname(__file__), "app.py")
|
|
||||||
|
# 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):
|
if not os.path.exists(app_path):
|
||||||
print(f"ERROR: app.py not found at {app_path}")
|
print(f" Searching for app.py near {script_dir}...")
|
||||||
input("Press Enter to exit...")
|
|
||||||
return False
|
# Check parent directory
|
||||||
print("✓ Application found: app.py\n")
|
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
|
# Start the app
|
||||||
print("[4/4] Starting web application...\n")
|
print("[4/4] Starting web application...\n")
|
||||||
@@ -86,7 +107,7 @@ def main():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Change to app directory and run
|
# Change to app directory and run
|
||||||
os.chdir(os.path.dirname(__file__))
|
os.chdir(script_dir)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Import and run the Flask app
|
# Import and run the Flask app
|
||||||
|
|||||||
Reference in New Issue
Block a user