Init Project Flexly CMS

This commit is contained in:
Alexey Dudin
2026-11-09 15:32:41 +03:00
commit c778db6208
115 changed files with 5098 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
"""Фабрика приложения. M0–M1: health и раздача `dist/current` для разработки.
Дальше: `POST /forms/{id}` и outbox (M2), админка `web/admin/` (M2–M3), превью по токену
`/_preview/<token>/` (M1), MCP на `/mcp/` (M3). В production статику отдаёт nginx.
"""
from __future__ import annotations
import os
from pathlib import Path
def create_app():
from fastapi import FastAPI, HTTPException
from fastapi.staticfiles import StaticFiles
app = FastAPI(title="Site Engine")
dist = Path(os.environ.get("SITE_DIST", "dist"))
@app.get("/healthz")
def healthz() -> dict:
return {"status": "ok"}
@app.post("/forms/{form_id}")
def submit_form(form_id: str) -> None:
raise HTTPException(status_code=501, detail="приём заявок появится в M2 (ADR-003)")
if (dist / "current").exists():
app.mount("/", StaticFiles(directory=dist / "current", html=True), name="site")
return app