Google News
logo
Flask - Interview Questions
How to share the global app object in flask?
You can create an overall package and add an __init__.py file under the package folder where you declare all the global variables that you need to share between the classes. Then, you should add the code "app = Flask(__name__)" in the __init__.py file. Now you can share and use the app variables anywhere if you just import the package name.
Advertisement