from quart import Quart from applications.config import aliyun_log_config from applications.database import mysql_manager from applications.service import LogService from routes import server_routes log_service = LogService(**aliyun_log_config) app = Quart(__name__) routes = server_routes(mysql_manager, log_service) app.register_blueprint(routes) @app.before_serving async def startup(): print("Starting application...") await mysql_manager.init_pools() print("Mysql pools init successfully") await log_service.start() print("aliyun log service init successfully") @app.after_serving async def shutdown(): print("Shutting down application...") await mysql_manager.close_pools() print("Mysql pools close successfully") await log_service.stop() print("aliyun log service stop successfully")