mirror of
https://github.com/fsecada01/Pygentic-AI.git
synced 2026-08-18 15:45:49 +00:00
refactor: use pathlib.Path for BASE_DIR, BACKEND_DIR, FRONTEND_DIR
Replaces os.path.dirname/join chains with Path(__file__).resolve() and / operator. Updated Settings field types from str to Path to satisfy pydantic v2 strict coercion. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
from backend.settings.consts import BACKEND_DIR, FRONTEND_DIR
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
backend_dir: str = BACKEND_DIR
|
||||
frontend_dir: str = FRONTEND_DIR
|
||||
backend_dir: Path = BACKEND_DIR
|
||||
frontend_dir: Path = FRONTEND_DIR
|
||||
|
||||
DB_URL: str = "sqlite+aiosqlite:///backend/pygentic_ai.sqlite3"
|
||||
DEBUG: bool = False
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import enum
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from decouple import config
|
||||
|
||||
BASE_DIR = os.path.dirname(
|
||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
)
|
||||
BACKEND_DIR = os.path.join(BASE_DIR, "backend")
|
||||
FRONTEND_DIR = os.path.join(BASE_DIR, "frontend")
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
BACKEND_DIR = BASE_DIR / "backend"
|
||||
FRONTEND_DIR = BASE_DIR / "frontend"
|
||||
|
||||
|
||||
pg_dialects = [
|
||||
|
||||
Reference in New Issue
Block a user