New files
storeapi/config.py
# Most of this taken from Redowan Delowar's post on configurations with Pydantic
# https://rednafi.github.io/digressions/python/2020/06/03/python-configs.html
from typing import Optional
from pydantic_settings import BaseSettings, SettingsConfigDict
class BaseConfig(BaseSettings):
"""Loads the dotenv file. Including this is necessary to get
pydantic to load a .env file."""
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
class GlobalConfig(BaseConfig):
DATABASE_URL: Optional[str] = None
DB_FORCE_ROLL_BACK: bool = False
Modified files
requirements.txt
---
+++
@@ -1,4 +1,5 @@
fastapi
+pydantic-settings
uvicorn[standard]
sqlalchemy
databases[aiosqlite]