generated from hjess/PythonTemplateProject
added middelware
Some checks failed
Build, Push, and Deploy to Nomad / docker-nomad (push) Has been cancelled
Some checks failed
Build, Push, and Deploy to Nomad / docker-nomad (push) Has been cancelled
This commit is contained in:
5
app.py
5
app.py
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user