From af484b68c9d8c39750918503d488b9d6f47a60e0 Mon Sep 17 00:00:00 2001 From: cuiweizhi <560397@gree.com.cn> Date: Sun, 12 Nov 2023 21:34:01 +0800 Subject: [PATCH] Update project --- application/__init__.py | 5 ----- application/common/__init__.py | 13 ------------- application/common/universal.py | 22 ---------------------- application/libs/tasks/task.py | 2 -- 4 files changed, 42 deletions(-) delete mode 100644 application/common/__init__.py delete mode 100644 application/common/universal.py diff --git a/application/__init__.py b/application/__init__.py index 5730cd2..4b51ca5 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 3d9cc1a..0000000 --- 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 5379ab8..0000000 --- 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 14925c5..5b39130 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") -- GitLab