mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2025-08-14 18:58:13 +08:00
fix rest
add custom home view
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user