-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (22 loc) · 654 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (22 loc) · 654 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
from fastapi import FastAPI
from starlette.staticfiles import StaticFiles
from starlette.templating import Jinja2Templates
async def not_found(request, exc):
return templates.TemplateResponse(
name="404.html",
context={
'request': request
},
status_code=exc.status_code
)
exceptions = {
404: not_found,
}
app = FastAPI(title='Quiz App', debug=True, exception_handlers=exceptions)
app.mount("/static", StaticFiles(directory='static'), name="static")
templates = Jinja2Templates(directory='templates')
@app.get('/')
async def home():
return {
'message': "Assalomu Alaykum."
}