diff --git a/application/__init__.py b/application/__init__.py index ea183bfa2467f02c576c6a37c74e5c0c2b38b9eb..4b51ca50798999b4319e2b2f52ac49dcabfeafc6 100644 --- a/application/__init__.py +++ b/application/__init__.py @@ -20,15 +20,29 @@ from application.script import init_script def create_app() -> Flask: - app = Flask(os.path.abspath(os.path.join(os.path.dirname(__file__), "."))) + """ + This function creates and initializes a new Flask application. - # 注册各种插件 + :return: A new instance of a Flask application. + """ + + # Determine the path of the application root directory + app_root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".")) + + # Create a new Flask application instance + app = Flask(app_root_path) + + # Initialize various plugins for the application. + # This could include things like database connectors, authentication systems, etc. init_plugs(app) - # 注册路由 + # Register the routes that this application will respond to. + # This includes both the route URLs and the handlers for each route. init_views(app) - # 注册命令 + # Register any scripts or commands that can be run from the command line. + # This could include data migration scripts, administrative tasks, etc. init_script(app) + # Return the fully initialized Flask application return app