Fix Pydantic v2 non-annotated attribute error in Settings class
This commit is contained in:
parent
be1a52976f
commit
f64c3ea80e
@ -1,6 +1,6 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from typing import Optional, ClassVar
|
||||
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
@ -20,7 +20,7 @@ class Settings(BaseSettings):
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
|
||||
|
||||
# Database
|
||||
DB_DIR = Path("/app") / "storage" / "db"
|
||||
DB_DIR: ClassVar[Path] = Path("/app") / "storage" / "db"
|
||||
DB_DIR.mkdir(parents=True, exist_ok=True)
|
||||
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
||||
|
||||
@ -28,8 +28,9 @@ class Settings(BaseSettings):
|
||||
FIRST_SUPERUSER_EMAIL: Optional[str] = os.getenv("FIRST_SUPERUSER_EMAIL")
|
||||
FIRST_SUPERUSER_PASSWORD: Optional[str] = os.getenv("FIRST_SUPERUSER_PASSWORD")
|
||||
|
||||
class Config:
|
||||
case_sensitive = True
|
||||
model_config = {
|
||||
"case_sensitive": True
|
||||
}
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
Loading…
x
Reference in New Issue
Block a user