DataSuitePro / config /settings.py
DePol1's picture
subida inicial
68e9069 verified
Raw History Blame Contribute Delete
1.64 kB
# config/settings.py
import os
from pathlib import Path
from typing import Dict, Any
def check_admin(password_input):
admin_hash = st.secrets["admin"]["hash"]
return bcrypt.checkpw(password_input.encode(), admin_hash.encode())
class Config:
"""Configuraci贸n principal de la aplicaci贸n"""
# Directorios base
BASE_DIR = Path(__file__).parent.parent
EXPORTS_DIR = BASE_DIR / "exports"
TEMPLATES_DIR = BASE_DIR / "templates"
# Formatos soportados
SUPPORTED_INPUT_FORMATS = ['.csv', '.json', '.xlsx', '.xls', '.txt']
SUPPORTED_OUTPUT_FORMATS = ['.csv', '.json', '.xlsx', '.txt', '.sql', '.db']
# L铆mites
MAX_FILE_SIZE_MB = 500
MAX_ROWS_PREVIEW = 1000
# Configuraci贸n APIs
API_FRAMEWORKS = ['fastapi', 'flask', 'django']
DATABASE_TYPES = ['sqlite', 'mysql', 'postgresql']
# Configuraci贸n por defecto
DEFAULT_API_CONFIG = {
'framework': 'fastapi',
'authentication': True,
'pagination': True,
'documentation': True,
'cors': True
}
@classmethod
def get_template_path(cls, template_type: str, template_name: str) -> Path:
"""Obtiene la ruta de una plantilla"""
return cls.TEMPLATES_DIR / template_type / f"{template_name}.j2"
@classmethod
def get_export_path(cls, export_type: str, project_name: str) -> Path:
"""Obtiene la ruta de exportaci贸n"""
export_dir = cls.EXPORTS_DIR / export_type / project_name
export_dir.mkdir(parents=True, exist_ok=True)
return export_dir
# Instancia global de configuraci贸n
config = Config()