Commit af484b68 authored by 崔为之's avatar 崔为之 💪🏽

Update project

parent 1c14fa79
...@@ -17,7 +17,6 @@ from flask import Flask ...@@ -17,7 +17,6 @@ from flask import Flask
from application.extensions import init_plugs from application.extensions import init_plugs
from application.views import init_views from application.views import init_views
from application.script import init_script from application.script import init_script
from application.common import global_config as gc
def create_app() -> Flask: def create_app() -> Flask:
...@@ -37,10 +36,6 @@ def create_app() -> Flask: ...@@ -37,10 +36,6 @@ def create_app() -> Flask:
# This could include things like database connectors, authentication systems, etc. # This could include things like database connectors, authentication systems, etc.
init_plugs(app) init_plugs(app)
# Set universal config
# 将 app.config 的内容复制到全局对象
gc.config = app.config.copy()
# Register the routes that this application will respond to. # Register the routes that this application will respond to.
# This includes both the route URLs and the handlers for each route. # This includes both the route URLs and the handlers for each route.
init_views(app) init_views(app)
......
#!/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
#!/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()
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
import datetime import datetime
from application.extensions.init_sqlalchemy import db from application.extensions.init_sqlalchemy import db
from application.models import User from application.models import User
from application.common import global_config
from application.libs.helper import MySQLHelper from application.libs.helper import MySQLHelper
...@@ -38,6 +37,5 @@ def task(): ...@@ -38,6 +37,5 @@ def task():
# user = User(username="CWzz", email="Stuu@outlook.com", password="qwe!2345", active=True, # user = User(username="CWzz", email="Stuu@outlook.com", password="qwe!2345", active=True,
# created_at=datetime.datetime.utcnow()) # created_at=datetime.datetime.utcnow())
# user.save() # user.save()
print(db.app.config)
print("created user admin") print("created user admin")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment