Open
Description
BUG:
@app.on_event("startup")
is deprecated, uselifespan=
handlers instead
Code currently works but will very likely stop working in future FastApi versions
@app.on_event("startup")
def on_startup():
conn()
@Youngestdev This is explained in the advanced documentation for lifespan events, and I understand the general idea (in that documentation) but it uses contextlib
and seems a bit advanced Python, so a rough rewrite of chaper 06 when calling conn()
function would be very helpful.
I'm assuming conn()
has to run once, and once only before startup (to create the database), and that get_session()
opens and closes the database for read/write automatically (for regular use).
Metadata
Metadata
Assignees
Labels
No labels