Skip to content

Helper function create_user gets error: DatabaseBackend is not running #513

Discussion options

You must be logged in to vote

When defining the FastAPI app, there are startup/shutdown events that take care of opening the database connection:

@app.on_event("startup")
async def startup():
    await database.connect()


@app.on_event("shutdown")
async def shutdown():
    await database.disconnect()

In your script, you have to take care of this yourself and call it in your function.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@augusto-herrmann
Comment options

Answer selected by augusto-herrmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants