From 40981760c919b78b3f2a58cdeb58df61d03f3bcf Mon Sep 17 00:00:00 2001 From: Automated Action Date: Tue, 17 Jun 2025 05:58:42 +0000 Subject: [PATCH] Fix Pydantic v2 configuration for application startup - Added proper type annotations for DB_DIR using ClassVar[Path] - Updated Settings class to use model_config instead of deprecated Config class - Fixed PydanticUserError for non-annotated attributes in settings - Application should now start properly with uvicorn --- app/core/config.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index dc21655..fce4c18 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -1,5 +1,6 @@ import os from pathlib import Path +from typing import ClassVar from pydantic_settings import BaseSettings @@ -16,12 +17,13 @@ class Settings(BaseSettings): VERSION: str = "0.1.0" # SQLite Database settings - DB_DIR = Path("/app") / "storage" / "db" + DB_DIR: ClassVar[Path] = Path("/app") / "storage" / "db" SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" - class Config: - case_sensitive = True - env_file = os.path.join(BASE_DIR, ".env") + model_config = { + "case_sensitive": True, + "env_file": os.path.join(BASE_DIR, ".env"), + } settings = Settings()