Templates support
This commit is contained in:
parent
8ef45fd03e
commit
043eaff5fd
@ -1,10 +1,15 @@
|
|||||||
"""Community Keycloak SSO user management."""
|
"""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()
|
app = FastAPI()
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/", response_class=HTMLResponse)
|
||||||
def read_root():
|
async def home(request: Request):
|
||||||
return {"Hello": "World"}
|
return templates.TemplateResponse(
|
||||||
|
"index.html", context={"request": request}
|
||||||
|
)
|
||||||
|
1
styles.css
Normal file
1
styles.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
// TODO
|
8
templates/index.html
Normal file
8
templates/index.html
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Home</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Hello, World</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user