#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # @Version : Python 3.11.4 # @Software : Sublime Text 4 # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 12:50 # @File : __init__.py # @Description : Initializes various plugins for a Flask application. """ from flask import Flask # Import the initialization functions in alphabetical order from .init_apispec import init_apispec from .init_apscheduler import init_tasks from .init_config import init_config from .init_consul import init_consul from .init_cors import init_cors from .init_dotenv import init_dotenv from .init_elasticsearch import init_elasticsearch from .init_logger import init_logger from .init_sqlalchemy import init_database def init_plugs(app: Flask) -> None: """ This function initializes various plugins for a Flask application. It accepts a Flask application instance as an argument, and calls a series of initialization functions on this instance, setting up several plugins. Each plugin is initialized by a function imported from a separate module. These initialization functions should take the Flask application instance as an argument, and set up the plugin for this instance. Note that the order in which these plugins are initialized can be important, as some plugins may depend on others being already initialized. """ # Initialize the environment variables init_dotenv() # Initialize the application configuration init_config(app) # Initialize the application logging init_logger(app) # Initialize the database connection init_database(app) # Initialize the API specification init_apispec(app) # Initialize the Elasticsearch client init_elasticsearch(app) # Initialize the CORS policy init_cors(app) # Initialize the Consul client init_consul(app) # Initialize the scheduled tasks init_tasks(app)