diff --git a/backend/main.py b/backend/main.py index 990e1ad..f3f76db 100644 --- a/backend/main.py +++ b/backend/main.py @@ -2,7 +2,6 @@ import sys import os import json -import tomllib from pathlib import Path from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware @@ -26,14 +25,20 @@ from app.database import Base, engine, SessionLocal, load_sample_data # Utility function to fetch metadata from pyproject.toml def get_project_metadata(): + from pathlib import Path + import tomllib + # Dynamically resolve the correct path to pyproject.toml root_dir = ( Path(__file__).resolve().parent.parent.parent ) # Adjust path to project root pyproject_path = root_dir / "pyproject.toml" + # Print the resolved path for debugging + print(f"Looking for pyproject.toml at: {pyproject_path}") + if not pyproject_path.exists(): - raise FileNotFoundError(f"pyproject.toml not found at {pyproject_path}") + raise FileNotFoundError(f"{pyproject_path} not found") with open(pyproject_path, "rb") as f: pyproject = tomllib.load(f)