Replies: 1 comment
-
Apparently, I expected something magic invoking Since everything starts from mian.py: from fastapi import FastAPI
from sqladmin import Admin
from .endpoints import router
from .database import engine
from .admins import UserAdmin
def create_app() -> FastAPI:
app = FastAPI(title="ai3d", openapi_url="/api/openapi.json", version="0.1.0")
app.include_router(router, prefix="/api")
return app
app = create_app()
admin = Admin(app, engine)
admin.add_view(UserAdmin) admins.py from sqladmin import ModelView
from . import models
class UserAdmin(ModelView, model=models.User):
column_list = [
models.User.id,
models.User.role,
models.User.email,
models.User.username,
] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I created an
admins.py
with the following content:Here's the model:
Database engine:
FastAPI app:
But after running the project via
Uvicorn
I can reach the admin panel neither byhttp://127.0.0.1:8000/admin
norhttp://127.0.0.1:8000/api/admin
What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions