From a542a3e6cb53a43fd5de6e6b0c22911f82b5df04 Mon Sep 17 00:00:00 2001 From: Automated Action Date: Mon, 12 May 2025 16:41:43 +0000 Subject: [PATCH] Fix database path to use current working directory for reliable permissions --- app/db/database.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/db/database.py b/app/db/database.py index 4052df5..1efbf98 100644 --- a/app/db/database.py +++ b/app/db/database.py @@ -4,14 +4,13 @@ from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker -# Get base project directory -PROJECT_DIR = Path(os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))) +# Get base project directory - using current working directory approach which is more reliable for permissions +PROJECT_DIR = Path.cwd() # Create database directory if it doesn't exist DB_DIR = PROJECT_DIR / "app" / "storage" / "db" # Ensure directory exists before accessing it -if not DB_DIR.exists(): - os.makedirs(DB_DIR, exist_ok=True) +os.makedirs(DB_DIR, exist_ok=True) SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"