Initial commit
This commit is contained in:
47
app/config.py
Normal file
47
app/config.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
Configuración de la aplicación
|
||||
"""
|
||||
from pydantic_settings import BaseSettings
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
# Base
|
||||
PROJECT_NAME: str = "Sistema de Gestión de Pedidos"
|
||||
VERSION: str = "1.0.0"
|
||||
DEBUG: bool = True
|
||||
|
||||
# Database
|
||||
DATABASE_URL: str = os.getenv(
|
||||
"DATABASE_URL",
|
||||
"postgresql://postgres:postgres@localhost:5432/pedidos_clientes"
|
||||
)
|
||||
|
||||
# OpenAI
|
||||
OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY", "")
|
||||
|
||||
# Paths
|
||||
BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
||||
PEDIDOS_CLIENTES_PDF_DIR: Path = BASE_DIR / "pedidos_clientes_pdf"
|
||||
ALBARANES_ESCANEADOS_DIR: Path = BASE_DIR / "albaranes_escaneados"
|
||||
EMAILS_PROVEEDORES_DIR: Path = BASE_DIR / "emails_proveedores"
|
||||
MEDIA_DIR: Path = BASE_DIR / "media"
|
||||
STATIC_DIR: Path = BASE_DIR / "static"
|
||||
|
||||
# CORS
|
||||
CORS_ORIGINS: list = ["*"]
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
case_sensitive = True
|
||||
|
||||
|
||||
# Crear carpetas si no existen
|
||||
settings = Settings()
|
||||
settings.PEDIDOS_CLIENTES_PDF_DIR.mkdir(exist_ok=True)
|
||||
settings.ALBARANES_ESCANEADOS_DIR.mkdir(exist_ok=True)
|
||||
settings.EMAILS_PROVEEDORES_DIR.mkdir(exist_ok=True)
|
||||
settings.MEDIA_DIR.mkdir(exist_ok=True)
|
||||
settings.STATIC_DIR.mkdir(exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user