From a4db1620ca9d5fa7e8b1231a00b231a5604c91eb Mon Sep 17 00:00:00 2001 From: f18326186224 Date: Mon, 11 Dec 2023 16:50:36 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=B5=8B=E8=AF=95=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E7=8E=AF=E5=A2=83=E6=98=AF=E5=90=A6=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E7=BA=BF=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/bootstrap.py | 15 +++++++++++---- index.py | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/core/bootstrap.py b/core/bootstrap.py index c0cb70b..ac5072e 100644 --- a/core/bootstrap.py +++ b/core/bootstrap.py @@ -4,10 +4,17 @@ # 导出所有components下__init__.py的蓝图文件 -def init(app: Flask, debug: bool = False): - +def mount(app: Flask): # 挂载蓝图 for blueprint in blueprints: app.register_blueprint(blueprint) - # 项目启动 - # app.run(debug=debug) + + +def run(app: Flask, debug: bool = False): + """本地启动项目 + + Args: + app (Flask): _description_ + debug (bool, optional): _description_. Defaults to False. + """ + app.run(debug=debug) diff --git a/index.py b/index.py index 84bfd52..0c82cd0 100644 --- a/index.py +++ b/index.py @@ -7,4 +7,7 @@ # 允许跨域 CORS(app) # 挂载路由 启动项目 -bootstrap.init(app=app) +bootstrap.mount(app=app) + +if __name__ == '__main__': + bootstrap.run(app)