Fix database path issues with relative path resolution to ensure proper directory creation and permissions
This commit is contained in:
parent
c196ff6cc8
commit
462c7e651e
@ -5,11 +5,13 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
# Get base project directory
|
||||
PROJECT_DIR = Path("/projects/simpletodoapplication-222fyi")
|
||||
PROJECT_DIR = Path(os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
|
||||
|
||||
# Create database directory if it doesn't exist
|
||||
DB_DIR = PROJECT_DIR / "app" / "storage" / "db"
|
||||
DB_DIR.mkdir(parents=True, exist_ok=True)
|
||||
# Ensure directory exists before accessing it
|
||||
if not DB_DIR.exists():
|
||||
os.makedirs(DB_DIR, exist_ok=True)
|
||||
|
||||
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user