Implementación inicial del sistema de automatización de redes sociales
- Estructura completa del proyecto con FastAPI - Modelos de base de datos (productos, servicios, posts, calendario, interacciones) - Publishers para X, Threads, Instagram, Facebook - Generador de contenido con DeepSeek API - Worker de Celery con tareas programadas - Dashboard básico con templates HTML - Docker Compose para despliegue - Documentación completa Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
71
app/main.py
Normal file
71
app/main.py
Normal file
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
Social Media Automation - Consultoría AS
|
||||
=========================================
|
||||
Sistema automatizado para la creación y publicación de contenido
|
||||
en redes sociales (X, Threads, Instagram, Facebook).
|
||||
"""
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from app.api.routes import posts, products, services, calendar, dashboard, interactions
|
||||
from app.core.config import settings
|
||||
from app.core.database import engine
|
||||
from app.models import Base
|
||||
|
||||
# Crear tablas en la base de datos
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
# Inicializar aplicación FastAPI
|
||||
app = FastAPI(
|
||||
title="Social Media Automation",
|
||||
description="Sistema de automatización de redes sociales para Consultoría AS",
|
||||
version="1.0.0",
|
||||
docs_url="/api/docs",
|
||||
redoc_url="/api/redoc",
|
||||
)
|
||||
|
||||
# Configurar CORS
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"], # En producción, especificar dominios
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Montar archivos estáticos
|
||||
app.mount("/static", StaticFiles(directory="dashboard/static"), name="static")
|
||||
|
||||
# Registrar rutas
|
||||
app.include_router(dashboard.router, prefix="", tags=["Dashboard"])
|
||||
app.include_router(posts.router, prefix="/api/posts", tags=["Posts"])
|
||||
app.include_router(products.router, prefix="/api/products", tags=["Products"])
|
||||
app.include_router(services.router, prefix="/api/services", tags=["Services"])
|
||||
app.include_router(calendar.router, prefix="/api/calendar", tags=["Calendar"])
|
||||
app.include_router(interactions.router, prefix="/api/interactions", tags=["Interactions"])
|
||||
|
||||
|
||||
@app.get("/api/health")
|
||||
async def health_check():
|
||||
"""Verificar estado del sistema."""
|
||||
return {
|
||||
"status": "healthy",
|
||||
"app": settings.APP_NAME,
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
||||
|
||||
@app.get("/api/stats")
|
||||
async def get_stats():
|
||||
"""Obtener estadísticas generales del sistema."""
|
||||
# TODO: Implementar estadísticas reales desde la BD
|
||||
return {
|
||||
"posts_today": 0,
|
||||
"posts_week": 0,
|
||||
"posts_month": 0,
|
||||
"pending_approval": 0,
|
||||
"scheduled": 0,
|
||||
"interactions_pending": 0
|
||||
}
|
||||
Reference in New Issue
Block a user