2022-04-15 12:26:43 +08:00

31 lines
1.2 KiB
Python

from flask import Flask
from config import load_config, WEB_HOST, WEB_PORT
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
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.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(WEB_HOST, WEB_PORT)