feat: initial implementation taller-wox.fitlabs.dev
Portal FastAPI + 5 endpoints REST para Bootcamp Agentic AI con watsonx Orchestrate (FactorIT). Single container, Coolify-ready. - Landing brandeado FIT con formulario de registro (honeypot anti-bot) - Tokens itsdangerous para descargas (24h expiry) - 5 endpoints API: historical/available procedures, member-insights, schedule, generate-report (Jinja2 + Plotly) - SQLite con upsert-on-email para leads + log de descargas - Admin endpoints (HTTP Basic): leads.json, leads.csv, stats - 23 tests pytest pasando - Dockerfile listo para Coolify con volúmenes persistentes (/app/leads.db, /app/app/data/reports_output, /app/material) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
47
app/main.py
Normal file
47
app/main.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from app import admin, benefits_api, frontend, reports_api
|
||||
from app.config import get_settings
|
||||
from app.db import init_db
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
app = FastAPI(title="taller-wox.fitlabs.dev", version="1.0.0")
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=False,
|
||||
allow_methods=["GET", "POST"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
_STATIC_DIR = Path(__file__).parent.parent / "static"
|
||||
app.mount("/static", StaticFiles(directory=str(_STATIC_DIR)), name="static")
|
||||
|
||||
app.include_router(frontend.router)
|
||||
app.include_router(benefits_api.router)
|
||||
app.include_router(reports_api.router)
|
||||
app.include_router(admin.router)
|
||||
|
||||
_reports_dir = Path(settings.reports_output_dir)
|
||||
_reports_dir.mkdir(parents=True, exist_ok=True)
|
||||
app.mount(
|
||||
"/api/reports/output",
|
||||
StaticFiles(directory=str(_reports_dir)),
|
||||
name="reports_output",
|
||||
)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
def on_startup() -> None:
|
||||
init_db()
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
return {"status": "ok", "base_url": settings.base_url}
|
||||
Reference in New Issue
Block a user