加载配置

This commit is contained in:
Jerry Yan 2022-04-15 16:17:30 +08:00
parent b6a99e246f
commit 46a04bceef
2 changed files with 2 additions and 6 deletions

7
app.py
View File

@ -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)

View File

@ -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