Fix Alembic migration import error and database path issues
This commit is contained in:
parent
e0517031bd
commit
06dafd5b0c
@ -36,7 +36,7 @@ script_location = migrations
|
|||||||
# output_encoding = utf-8
|
# output_encoding = utf-8
|
||||||
|
|
||||||
# SQLite URL example
|
# SQLite URL example
|
||||||
sqlalchemy.url = sqlite:////app/storage/db/db.sqlite
|
sqlalchemy.url = sqlite:///%(here)s/storage/db/db.sqlite
|
||||||
|
|
||||||
[post_write_hooks]
|
[post_write_hooks]
|
||||||
# post_write_hooks defines scripts or Python functions that are run
|
# post_write_hooks defines scripts or Python functions that are run
|
||||||
|
@ -21,7 +21,9 @@ class Settings(BaseSettings):
|
|||||||
raise ValueError(v)
|
raise ValueError(v)
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_DIR: Path = Path("/app") / "storage" / "db"
|
# Get the project root directory dynamically
|
||||||
|
BASE_DIR: Path = Path(__file__).parent.parent.parent.absolute()
|
||||||
|
DB_DIR: Path = BASE_DIR / "storage" / "db"
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
case_sensitive = True
|
case_sensitive = True
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
from logging.config import fileConfig
|
from logging.config import fileConfig
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Add the project root directory to the Python path
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
|
||||||
|
|
||||||
from sqlalchemy import engine_from_config
|
from sqlalchemy import engine_from_config
|
||||||
from sqlalchemy import pool
|
from sqlalchemy import pool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user