diff --git a/application/__init__.py b/application/__init__.py index 5730cd28ca8d2902d58df6a9a62766f99951aff1..4b51ca50798999b4319e2b2f52ac49dcabfeafc6 100644 --- a/application/__init__.py +++ b/application/__init__.py @@ -17,7 +17,6 @@ from flask import Flask from application.extensions import init_plugs from application.views import init_views from application.script import init_script -from application.common import global_config as gc def create_app() -> Flask: @@ -37,10 +36,6 @@ def create_app() -> Flask: # This could include things like database connectors, authentication systems, etc. init_plugs(app) - # Set universal 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. init_views(app) diff --git a/application/common/__init__.py b/application/common/__init__.py deleted file mode 100644 index 3d9cc1a77a39514409a959357045576a244be379..0000000000000000000000000000000000000000 --- a/application/common/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -# @Version : Python 3.11.4 -# @Software : Sublime Text 4 -# @Author : StudentCWZ -# @Email : StudentCWZ@outlook.com -# @Date : 2023/11/3 19:42 -# @File : __init__.py -# @Description : -""" - -from .universal import global_config diff --git a/application/common/universal.py b/application/common/universal.py deleted file mode 100644 index 5379ab825af2072c5681468062ca22c3a1a960b2..0000000000000000000000000000000000000000 --- a/application/common/universal.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -# @Version : Python 3.11.4 -# @Software : Sublime Text 4 -# @Author : StudentCWZ -# @Email : StudentCWZ@outlook.com -# @Date : 2023/11/11 14:11 -# @File : universal.py -# @Description : -""" - - -# universal.py -class GlobalConfig: - """Configuration for the application.""" - def __init__(self): - self.config = {} - - -# This creates a global instance of the Config class -global_config = GlobalConfig() diff --git a/application/libs/tasks/task.py b/application/libs/tasks/task.py index 14925c58e4f4c842b0f7b320ff79120b79960554..5b3913091efa1f4437fa71ba162b37db42a9bac8 100644 --- a/application/libs/tasks/task.py +++ b/application/libs/tasks/task.py @@ -13,7 +13,6 @@ import datetime from application.extensions.init_sqlalchemy import db from application.models import User -from application.common import global_config from application.libs.helper import MySQLHelper @@ -38,6 +37,5 @@ def task(): # user = User(username="CWzz", email="Stuu@outlook.com", password="qwe!2345", active=True, # created_at=datetime.datetime.utcnow()) # user.save() - print(db.app.config) print("created user admin")