Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occurs an error and does not work. #11

Open
Yangeok opened this issue Apr 25, 2024 · 1 comment
Open

Occurs an error and does not work. #11

Yangeok opened this issue Apr 25, 2024 · 1 comment

Comments

@Yangeok
Copy link

Yangeok commented Apr 25, 2024

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?

@guofei1989
Copy link

You can refer to : #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants