-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
47 lines (35 loc) · 847 Bytes
/
Copy pathapp.py
File metadata and controls
47 lines (35 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
import config
app = FastAPI(
title=config.APP_NAME,
version="0.1.0",
)
app.mount(
"/static",
StaticFiles(directory="static"),
name="static",
)
app.mount(
"/outputs",
StaticFiles(directory="outputs"),
name="outputs",
)
templates = Jinja2Templates(directory="templates")
@app.get("/", response_class=HTMLResponse)
async def home(request: Request):
return templates.TemplateResponse(
request=request,
name="index.html",
context={
"title": config.APP_NAME,
},
)
@app.get("/health")
async def health():
return {
"status": "ok",
"application": config.APP_NAME,
}