Repository navigation
Can an app state instance be removed? #2995
Replies: 1 comment
|
Yes, you can remove attributes from # Using attribute syntax
del app.state.stuff
# Or dynamically with delattr
delattr(app.state, "stuff")Under the hood, Starlette's def __delattr__(self, key: Any) -> None:
del self._state[key]After deletion:
If you try to delete an attribute that doesn't exist, it will raise a standard if hasattr(app.state, "stuff"):
del app.state.stuff |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
app.state.stuff = do_stuff()Is it possible to remove (delete) the instance
stufffromapp.state?All reactions