added middelware
Some checks failed
Build, Push, and Deploy to Nomad / docker-nomad (push) Has been cancelled

This commit is contained in:
2024-12-10 21:13:58 +01:00
parent 1b56d7fef1
commit 1175d40710

5
app.py
View File

@@ -6,12 +6,17 @@ import json
import os
from starlette.middleware.httpsredirect import HTTPSRedirectMiddleware
from fastapi.middleware.trustedhost import TrustedHostMiddleware
from starlette.middleware.proxy_headers import ProxyHeadersMiddleware
app = FastAPI()
# Mount static files
app.mount("/static", StaticFiles(directory="static"), name="static")
app.add_middleware( HTTPSRedirectMiddleware )
app.add_middleware(ProxyHeadersMiddleware)
app.add_middleware(TrustedHostMiddleware, allowed_hosts=["*"])
# Templates directory
templates = Jinja2Templates(directory="templates")