From 46a04bceefcae106348cba8ae05257e0f37c1ac5 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 15 Apr 2022 16:17:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 7 +------ config.py | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index e0b8b2c..972492b 100644 --- a/app.py +++ b/app.py @@ -11,17 +11,12 @@ app = Flask(__name__) app.config['JSON_AS_ASCII'] = False # CORS(app, supports_credentials=True) app.debug = True +load_config() app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///database.db?check_same_thread=False" app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) - -@app.before_first_request -def _load_config(): - load_config() - - app.register_blueprint(view_main_blueprint) app.register_blueprint(api_config_blueprint) app.register_blueprint(api_collector_blueprint) diff --git a/config.py b/config.py index 5f90e11..47c84ce 100644 --- a/config.py +++ b/config.py @@ -36,6 +36,7 @@ def load_config(): write_config() return False config = configparser.ConfigParser() + config.read("config.ini", encoding="utf-8") if config.has_section("danmaku"): section = config['danmaku'] global DANMAKU_FACTORY_EXEC, DANMAKU_SPEED, DEFAULT_FONT_NAME, VIDEO_RESOLUTION