diff --git a/application/__init__.py b/application/__init__.py index 2e2372a99b9d17c6539bb154079e2ae8eb9b6fe1..ac528a7a322bd4cf3abeab699cb128e6490c6102 100644 --- a/application/__init__.py +++ b/application/__init__.py @@ -18,7 +18,7 @@ from application.extensions import init_plugs from application.views import init_views from application.script import init_script from application.utils import make_celery -from application.common import config +from application.common import global_config as gc def create_app() -> Flask: @@ -39,7 +39,8 @@ def create_app() -> Flask: init_plugs(app) # Set universal config - config.universal = app.config + # 将 app.config 的内容复制到全局对象 + gc.config = app.config.copy() # Register the routes that this application will respond to. # This includes both the route URLs and the handlers for each route. diff --git a/application/common/__init__.py b/application/common/__init__.py index 52f613cec30802fe71d0c34e2ebb413835011c62..3d9cc1a77a39514409a959357045576a244be379 100644 --- a/application/common/__init__.py +++ b/application/common/__init__.py @@ -10,4 +10,4 @@ # @Description : """ -from .config import Config +from .universal import global_config diff --git a/application/common/config.py b/application/common/universal.py similarity index 75% rename from application/common/config.py rename to application/common/universal.py index ce06588bec716989c385ae3ea433822365f41d28..5379ab825af2072c5681468062ca22c3a1a960b2 100644 --- a/application/common/config.py +++ b/application/common/universal.py @@ -6,17 +6,17 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/11 14:11 -# @File : config.py +# @File : universal.py # @Description : """ -# config.py -class Config: +# universal.py +class GlobalConfig: """Configuration for the application.""" def __init__(self): - self.universal = None + self.config = {} # This creates a global instance of the Config class -config = Config() +global_config = GlobalConfig() diff --git a/application/libs/helper/config.py b/application/libs/helper/config.py index 6b463d562ad3e9eb310d1688f769d2c67504d69d..862c9e3ede84f9d3ad85feff3d2addaef0783d9d 100644 --- a/application/libs/helper/config.py +++ b/application/libs/helper/config.py @@ -6,7 +6,7 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/3 19:43 -# @File : config.py +# @File : universal.py # @Description : """