41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
from starlette.responses import Response
|
|
|
|
from led_platform.api.http import STATIC_DIR, router as http_router
|
|
from led_platform.api.ws import router as ws_router
|
|
from led_platform.core.config import get_settings
|
|
|
|
|
|
class NoCacheStaticFiles(StaticFiles):
|
|
async def get_response(self, path: str, scope: dict) -> Response:
|
|
response = await super().get_response(path, scope)
|
|
response.headers["Cache-Control"] = "no-store"
|
|
return response
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
app = FastAPI(
|
|
title="LED Wall Projection Platform",
|
|
version="1.0.0",
|
|
description="Tile-aware dual GPU-server LED wall control and synchronization platform.",
|
|
)
|
|
app.mount("/static", NoCacheStaticFiles(directory=STATIC_DIR), name="static")
|
|
app.include_router(http_router)
|
|
app.include_router(ws_router)
|
|
return app
|
|
|
|
|
|
app = create_app()
|
|
|
|
|
|
def main() -> None:
|
|
import uvicorn
|
|
|
|
settings = get_settings()
|
|
uvicorn.run("led_platform.main:app", host=settings.app_host, port=settings.app_port)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|