Skip to content

Occurs an error and does not work. #11

Description

@Yangeok

I installed the necessary packages and copied and executed the script provided as an example, but encountered an error.

Below is stack trace:

INFO:     Will watch for changes in these directories: ['/Users/***']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [92055] using StatReload
INFO:     Started server process [92059]
INFO:     Waiting for application startup.
ERROR:    Traceback (most recent call last):
  File "/Users/***/.venv/lib/python3.12/site-packages/starlette/routing.py", line 686, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/Users/***/.venv/lib/python3.12/site-packages/starlette/routing.py", line 575, in __aenter__
    await self._router.startup()
  File "/Users/***/.venv/lib/python3.12/site-packages/starlette/routing.py", line 663, in startup
    await handler()
  File "/Users/***/src/main.py", line 33, in startup
    site.mount_app(app)
  File "/Users/***/.venv/lib/python3.12/site-packages/fastapi_amis_admin/admin/admin.py", line 1541, in mount_app
    fastapi.add_middleware(BaseHTTPMiddleware, dispatch=self.db.asgi_dispatch)
  File "/Users/***/.venv/lib/python3.12/site-packages/starlette/applications.py", line 139, in add_middleware
    raise RuntimeError("Cannot add middleware after an application has started")
RuntimeError: Cannot add middleware after an application has started

ERROR:    Application startup failed. Exiting.

Need help. How can I resolve this problem?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions