from flask import Flask from config import load_config from controller.view.main_blueprint import blueprint as view_main_blueprint from controller.api.config_blueprint import blueprint as api_config_blueprint from controller.api.collector_blueprint import blueprint as api_collector_blueprint from controller.api.bilirecorder_blueprint import blueprint as api_bilirecorder_blueprint from controller.api.workflow_blueprint import blueprint as api_workflow_blueprint from model import db app = Flask(__name__) app.config['JSON_AS_ASCII'] = False # CORS(app, supports_credentials=True) app.debug = True 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) app.register_blueprint(api_bilirecorder_blueprint) app.register_blueprint(api_workflow_blueprint) with app.app_context(): # db.drop_all(app=app) db.create_all(app=app) if __name__ == '__main__': app.run()