加载配置

This commit is contained in:
Jerry Yan 2022-04-15 16:13:54 +08:00
parent 900b1bd614
commit b6a99e246f

7
app.py
View File

@ -11,12 +11,17 @@ 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)