add custom home view
This commit is contained in:
long2ice
2020-04-26 15:45:39 +08:00
parent fe80e7fd1b
commit 04d5e04dee
13 changed files with 91 additions and 88 deletions

View File

@ -1,6 +1,7 @@
import uvicorn
from fastapi import FastAPI, Depends
from starlette.middleware.cors import CORSMiddleware
from starlette.templating import Jinja2Templates
from tortoise.contrib.fastapi import register_tortoise
from tortoise.contrib.pydantic import pydantic_queryset_creator
from fastapi_admin.depends import get_model
@ -20,6 +21,8 @@ TORTOISE_ORM = {
}
}
templates = Jinja2Templates(directory='templates')
@admin_app.post(
'/{resource}/bulk/test_bulk'
@ -34,6 +37,15 @@ async def test_bulk(
return ret.dict()
@admin_app.get(
'/home',
)
async def home():
return {
'html': templates.get_template('home.html').render()
}
def create_app():
fast_app = FastAPI(debug=True)