Skip to content

Is it possible to get FastApi global state? #517

Closed Answered by rossmacarthur
smuglik asked this question in Q&A
Discussion options

You must be logged in to vote

Also had this issue, I had to attach the FastAPI app to the admin app to be able to access it in requests to the admin app.

app = FastAPI()
admin = Admin(app, engine)
admin.admin.parent = app

Now in your request you can access the state like this

request.app.parent.state

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aminalaee
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