amisadmin / fastapi-scheduler

FastAPI-Scheduler is a simple scheduled task management FastAPI extension based on APScheduler.
82 stars 13 forks source link

RuntimeError: Cannot add middleware after an application has started #7

Closed lijc210 closed 10 months ago

lijc210 commented 10 months ago

fastapi 0.100.0/0.101.1 fastapi_amis_admin 0.6.4 fastapi_scheduler 0.0.13

lijc210 commented 10 months ago

The code has been modified to work as follows

site.mount_app(app)

@app.on_event("startup") async def startup():

Mount the background management system

# site.mount_app(app)
# Start the scheduled task scheduler
scheduler.start()