From 0976a33bcec0fd09e9faf78d0b27a4808ea33015 Mon Sep 17 00:00:00 2001 From: Reviflow Bot Date: Sat, 31 Jan 2026 12:28:10 +0100 Subject: [PATCH] fix(backend): add debug logs and remove invalid main.py volume mount --- backend/app/main.py | 16 +++++++++++++++- docker-compose.yml | 1 - 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index 018fdd3..3ef2ce0 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -19,7 +19,21 @@ async def log_requests(request: Request, call_next): @app.on_event("startup") async def on_startup(): - await create_db_and_tables() + print("DEBUG: Startup initiated") + import os + print(f"DEBUG: Current Working Directory: {os.getcwd()}") + print(f"DEBUG: Directory Contents: {os.listdir('.')}") + print(f"DEBUG: Environment DATABASE_URL: {os.getenv('DATABASE_URL')}") + + try: + print("DEBUG: Attempting to create DB and tables...") + await create_db_and_tables() + print("DEBUG: DB creation successful.") + except Exception as e: + print(f"CRITICAL ERROR: Failed to connect to DB or create tables. Error: {e}") + import traceback + traceback.print_exc() + # Debug: Check static files location static_path = os.path.join(os.path.dirname(__file__), "..", "static") print(f"Startup: Static dir check -> {os.path.abspath(static_path)} (Exists: {os.path.exists(static_path)})") diff --git a/docker-compose.yml b/docker-compose.yml index f0b04cf..6988a8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,6 @@ services: - OPENROUTER_API_KEY=${OPENROUTER_API_KEY} volumes: - ./backend/app:/app/backend/app - - ./backend/main.py:/app/backend/main.py depends_on: db: condition: service_healthy