diff --git a/backend/start_alwrity_backend.py b/backend/start_alwrity_backend.py index 613e9092..360fffe9 100644 --- a/backend/start_alwrity_backend.py +++ b/backend/start_alwrity_backend.py @@ -311,31 +311,33 @@ def start_backend(enable_reload=False, production_mode=False): port = int(os.getenv("PORT", "8000")) reload = os.environ.get("RELOAD", "false").lower() == "true" - print(f" šŸ“ Host: {host}") - print(f" šŸ”Œ Port: {port}") - print(f" šŸ”„ Reload: {reload}") - print(f"[DEBUG] Starting server with host={host}, port={port}") + print(f" šŸ“ Host: {host}", flush=True) + print(f" šŸ”Œ Port: {port}", flush=True) + print(f" šŸ”„ Reload: {reload}", flush=True) + print(f"[DEBUG] Starting server with host={host}, port={port}", flush=True) + print(f"[DEBUG] About to import app and run uvicorn...", flush=True) try: # Import and run the app from app import app import uvicorn + print(f"[DEBUG] Imported app and uvicorn successfully", flush=True) # Note: Database already initialized by DatabaseSetup in main() - print("\n🌐 ALwrity Backend Server") - print("=" * 50) - print(" šŸ“– API Documentation: http://localhost:8000/api/docs") - print(" šŸ” Health Check: http://localhost:8000/health") - print(" šŸ“Š ReDoc: http://localhost:8000/api/redoc") + print("\n🌐 ALwrity Backend Server", flush=True) + print("=" * 50, flush=True) + print(" šŸ“– API Documentation: http://localhost:8000/api/docs", flush=True) + print(" šŸ” Health Check: http://localhost:8000/health", flush=True) + print(" šŸ“Š ReDoc: http://localhost:8000/api/redoc", flush=True) if not production_mode: - print(" šŸ“ˆ API Monitoring: http://localhost:8000/api/content-planning/monitoring/health") - print(" šŸ’³ Billing Dashboard: http://localhost:8000/api/subscription/plans") - print(" šŸ“Š Usage Tracking: http://localhost:8000/api/subscription/usage/demo") + print(" šŸ“ˆ API Monitoring: http://localhost:8000/api/content-planning/monitoring/health", flush=True) + print(" šŸ’³ Billing Dashboard: http://localhost:8000/api/subscription/plans", flush=True) + print(" šŸ“Š Usage Tracking: http://localhost:8000/api/subscription/usage/demo", flush=True) - print("\n[STOP] Press Ctrl+C to stop the server") - print("=" * 50) + print("\n[STOP] Press Ctrl+C to stop the server", flush=True) + print("=" * 50, flush=True) # Set up clean logging for end users from logging_config import setup_clean_logging, get_uvicorn_log_level @@ -402,11 +404,14 @@ def start_backend(enable_reload=False, production_mode=False): ], log_level=uvicorn_log_level ) + print("[DEBUG] uvicorn.run() has finished", flush=True) except KeyboardInterrupt: print("\n\nšŸ›‘ Backend stopped by user") except Exception as e: - print(f"\n[ERROR] Error starting backend: {e}") + print(f"\n[ERROR] Error starting backend: {e}", flush=True) + import traceback + traceback.print_exc() return False return True