Fix database path to use file-based path resolution for reliable permissions and access
This commit is contained in:
parent
a542a3e6cb
commit
88aa1a09dd
@ -52,7 +52,8 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne
|
||||
# are written from script.py.mako
|
||||
# output_encoding = utf-8
|
||||
|
||||
sqlalchemy.url = sqlite:////projects/simpletodoapplication-222fyi/app/storage/db/db.sqlite
|
||||
# This URL is overridden by the one from app.db.database in env.py
|
||||
sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||
|
||||
|
||||
[post_write_hooks]
|
||||
|
@ -4,10 +4,14 @@ from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
# Get base project directory - using current working directory approach which is more reliable for permissions
|
||||
PROJECT_DIR = Path.cwd()
|
||||
# Get base project directory - using current file location approach which is more reliable
|
||||
# Get the directory of this file
|
||||
CURRENT_FILE_DIR = Path(__file__).resolve().parent
|
||||
|
||||
# Create database directory if it doesn't exist
|
||||
# Get project root (2 levels up from db directory)
|
||||
PROJECT_DIR = CURRENT_FILE_DIR.parent.parent
|
||||
|
||||
# Create database directory in the project directory
|
||||
DB_DIR = PROJECT_DIR / "app" / "storage" / "db"
|
||||
# Ensure directory exists before accessing it
|
||||
os.makedirs(DB_DIR, exist_ok=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user