|  | @@ -0,0 +1,43 @@
 | 
	
		
			
				|  |  | +from flask import Flask
 | 
	
		
			
				|  |  | +import sentry_sdk
 | 
	
		
			
				|  |  | +from sentry_sdk.integrations.flask import FlaskIntegration
 | 
	
		
			
				|  |  | +from apscheduler_elab import Config
 | 
	
		
			
				|  |  | +from flask_apscheduler import APScheduler
 | 
	
		
			
				|  |  | +import importlib
 | 
	
		
			
				|  |  | +import os
 | 
	
		
			
				|  |  | +from file_util import FileUtil
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +sentry_sdk.init(
 | 
	
		
			
				|  |  | +    dsn="https://e9f173e651684e9080a7b297d51512c7@o382660.ingest.sentry.io/5211871",
 | 
	
		
			
				|  |  | +    integrations=[FlaskIntegration()])
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def create_app():
 | 
	
		
			
				|  |  | +    app_instance = Flask(__name__)
 | 
	
		
			
				|  |  | +    app.config.from_object(Config())
 | 
	
		
			
				|  |  | +    blueprint_list = []
 | 
	
		
			
				|  |  | +    path = os.path.dirname(os.path.abspath(__file__)) + r'/blue'
 | 
	
		
			
				|  |  | +    file_list = FileUtil.load_file(path)
 | 
	
		
			
				|  |  | +    for file_path in file_list:
 | 
	
		
			
				|  |  | +        file_name = os.path.split(file_path)[1].split('.')[0]
 | 
	
		
			
				|  |  | +        blueprint_list.append(file_name)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for blueprint in blueprint_list:
 | 
	
		
			
				|  |  | +        auto_blueprint_module = importlib.import_module('blue.' + str(blueprint))
 | 
	
		
			
				|  |  | +        auto_blueprint = auto_blueprint_module.__dict__[blueprint]
 | 
	
		
			
				|  |  | +        app.register_blueprint(auto_blueprint, url_prefix='/' + str(blueprint))
 | 
	
		
			
				|  |  | +    return app_instance
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +app = create_app()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +if __name__ == '__main__':
 | 
	
		
			
				|  |  | +    scheduler = APScheduler()
 | 
	
		
			
				|  |  | +    scheduler.init_app(app)
 | 
	
		
			
				|  |  | +    scheduler.start()
 | 
	
		
			
				|  |  | +    app.run(
 | 
	
		
			
				|  |  | +        host='0.0.0.0',
 | 
	
		
			
				|  |  | +        port=5001
 | 
	
		
			
				|  |  | +    )
 |