Templates support

This commit is contained in:
decentral1se 2021-06-11 14:14:04 +02:00
parent 8ef45fd03e
commit 043eaff5fd
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A
3 changed files with 18 additions and 4 deletions

View File

@ -1,10 +1,15 @@
"""Community Keycloak SSO user management."""
from fastapi import FastAPI
from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates(directory="templates")
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/", response_class=HTMLResponse)
async def home(request: Request):
return templates.TemplateResponse(
"index.html", context={"request": request}
)

1
styles.css Normal file
View File

@ -0,0 +1 @@
// TODO

8
templates/index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<title>Home</title>
</head>
<body>
<p>Hello, World</p>
</body>
</html>