Skip to content

Quick start

Install

pip install fastapi_amis_admin

Simple example

  1. Create the file adminsite.py:
from fastapi_amis_admin.admin.settings import Settings
from fastapi_amis_admin.admin.site import AdminSite
from fastapi_amis_admin.admin import admin
from fastapi_amis_admin.amis.components import PageSchema

# Create AdminSite instance
site = AdminSite(settings=Settings(database_url_async='sqlite+aiosqlite:///amisadmin.db'))


# Registration management class
@site.register_admin
class GitHubIframeAdmin(admin.IframeAdmin):
    # Set page menu information
    page_schema = PageSchema(label='AmisIframeAdmin', icon='fa fa-github')
    # Set the jump link
    src = 'https://github.com/amisadmin/fastapi_amis_admin'
  1. Create the file main.py:
from fastapi import FastAPI
from adminsite import site

app = FastAPI()

# Mount the background management system
site.mount_app(app)

if __name__ == '__main__':
    import uvicorn

    uvicorn.run(app)

Run the program

uvicorn main:app

Interface preview

  • Open a browser to access: http://127.0.0.1:8000/admin/

Smple program

  • FastAPI-User-Auth: A simple and powerful FastAPI user RBAC authentication and authorization library.
  • FastAPI-Scheduler: A simple scheduled task management project based on FastAPI+APScheduler.

More features