Fix Pydantic error by adding type annotation to DB_DIR and updating to Pydantic v2 configs
This commit is contained in:
parent
e228630abf
commit
a58bd6ed4a
@ -24,13 +24,11 @@ class Settings(BaseSettings):
|
||||
raise ValueError(v)
|
||||
|
||||
# Database configuration
|
||||
DB_DIR = Path("/app") / "storage" / "db"
|
||||
DB_DIR: Path = Path("/app") / "storage" / "db"
|
||||
DB_DIR.mkdir(parents=True, exist_ok=True)
|
||||
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
||||
|
||||
class Config:
|
||||
case_sensitive = True
|
||||
env_file = ".env"
|
||||
model_config = {"case_sensitive": True, "env_file": ".env"}
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
@ -27,8 +27,7 @@ class ItemInDBBase(ItemBase):
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
# Properties to return to client
|
||||
|
Loading…
x
Reference in New Issue
Block a user