#on_startup or on_app_init which happens first?

1 messages · Page 1 of 1 (latest)

unreal lake
#

The documentation states:

`on_startup: list[LifespanHook]
A list of LifespanHook called during application startup.'

and

`The parameters provided to the Litestar app are used to instantiate an instance, and then the instance is passed to any callbacks registered to on_app_init in the order they are provided.

The final attribute values are used to instantiate the application object.`

On Start Up has a like of Life Span Hooks and On App Init does not.
But, my question is which of these happen first?

I want to use a method like

    global JWT_secret
    JWT_secret = str(secrets.token_hex(16))```

to set the value of  the variable I'll be using JWT authentication,
In this use case, does it matter which one I use?
dusk mulchBOT
#
Notes for on_startup or on_app_init which happens first?
At your assistance

@unreal lake

No Response?

If no response in a reasonable time, ping @Member.

Closing

To close, type !solve or byte solve.

MCVE

Please include an MCVE so that we can reproduce your issue locally.

unreal lake
#

Nevermind, looks like i have to use on startup,
If I try to use on app init I get an error, and I can accept this

lilac roost
#

byte solve