加载配置
This commit is contained in:
parent
b6a99e246f
commit
46a04bceef
7
app.py
7
app.py
@ -11,17 +11,12 @@ app = Flask(__name__)
|
|||||||
app.config['JSON_AS_ASCII'] = False
|
app.config['JSON_AS_ASCII'] = False
|
||||||
# CORS(app, supports_credentials=True)
|
# CORS(app, supports_credentials=True)
|
||||||
app.debug = True
|
app.debug = True
|
||||||
|
load_config()
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///database.db?check_same_thread=False"
|
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///database.db?check_same_thread=False"
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
||||||
app.config['SQLALCHEMY_ECHO'] = True
|
app.config['SQLALCHEMY_ECHO'] = True
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
|
||||||
|
|
||||||
@app.before_first_request
|
|
||||||
def _load_config():
|
|
||||||
load_config()
|
|
||||||
|
|
||||||
|
|
||||||
app.register_blueprint(view_main_blueprint)
|
app.register_blueprint(view_main_blueprint)
|
||||||
app.register_blueprint(api_config_blueprint)
|
app.register_blueprint(api_config_blueprint)
|
||||||
app.register_blueprint(api_collector_blueprint)
|
app.register_blueprint(api_collector_blueprint)
|
||||||
|
@ -36,6 +36,7 @@ def load_config():
|
|||||||
write_config()
|
write_config()
|
||||||
return False
|
return False
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
|
config.read("config.ini", encoding="utf-8")
|
||||||
if config.has_section("danmaku"):
|
if config.has_section("danmaku"):
|
||||||
section = config['danmaku']
|
section = config['danmaku']
|
||||||
global DANMAKU_FACTORY_EXEC, DANMAKU_SPEED, DEFAULT_FONT_NAME, VIDEO_RESOLUTION
|
global DANMAKU_FACTORY_EXEC, DANMAKU_SPEED, DEFAULT_FONT_NAME, VIDEO_RESOLUTION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user