I want to use Flask to create a web API for my application, but have some problems to make my flask app aware of my other objects.
- I want to use Flask in order to be able to interact with my application through http requests. So the whole flask application in my case is just an external API, and relies on a core application.
- Let's imagine that my flask application will have to perform database calls.
- To manage database calls in my application, I use a single object that connects to the db ans implements some kind of Queue.
- That means my core application running in the background has a reference to my db object in order to make db calls.
- This is done by giving a reference to my queue object to this core application.
- Now I want to be able to perform actions on the db using a flask application too.
What is the correct way to pass a reference to this Queue object to my Flask application?
If I define all my objects at module level, I have no way to interact with them afterwards, do I?
All the example of Flask applications use Flask as the core of their system and define everything in their app on module level. How do I make Flask just a part of my app?