Code inside an event cannot access Flask's app context #1130
-
I have a flask application as a client application and am using socketio.Client to connect it to the server. I have an event that data is passed into then the event writes the data into the database. I am using Flask_SQLAlchemy for the models. I am facing a major issue in that code inside the event cannot write or query the database using the models since its working outside the app context. I have tried pushing the app context using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Have you tried using the actual application instance to push the app context instead of |
Beta Was this translation helpful? Give feedback.
Have you tried using the actual application instance to push the app context instead of
current_app
? That's the correct way to do it.