"""A Flask webapp.Application factory.From the ``Flask`` docs: Instead of creating a ``Flask`` instance globally, we will create it inside a function. This function is known as the application factory. Any configuration, registration, and other set up the application needs will happen inside the function, then the application will be returned.The app will be passed through to each ``init_app`` declaration, uniqueto its respective module. These functions will configure the appdesigned in this package.Registers: * This app's commandline interface * Config object from config module * Exceptions for handling error pages * This app's registered ``Flask`` extensions * Loggers from logging * Blueprints containing routing logic * This app's interactive shell"""fromflaskimportFlaskfromappimportcli,config,exceptions,extensions,fs,log,shell,viewsfromapp.versionimport__version__
[docs]defcreate_app()->Flask:"""Create ``Flask`` web application object. Accessible through wsgi.py. :return: Web application initialized and processed through factory pattern. """app=Flask(__name__)config.init_app(app)log.init_app(app)extensions.init_app(app)views.init_app(app)exceptions.init_app(app)shell.init_app(app)cli.init_app(app)fs.init_app(app)returnapp