(config_object=FlaskAppConfig)
| 16 | |
| 17 | |
| 18 | def create_app(config_object=FlaskAppConfig): |
| 19 | app = Flask(__name__) |
| 20 | app.config.from_object(config_object) |
| 21 | CORS(app) |
| 22 | |
| 23 | |
| 24 | # Initialize app with extensions |
| 25 | db.init_app(app) |
| 26 | migrate = Migrate(app, db) |
| 27 | with app.app_context(): |
| 28 | if DB_MANAGED_METADATA: |
| 29 | db.create_all() |
| 30 | load_tables_and_types_metadata() |
| 31 | load_in_context_examples() |
| 32 | admin = Admin(None, name='admin', template_mode='bootstrap3') |
| 33 | admin.init_app(app) |
| 34 | |
| 35 | |
| 36 | @app.route("/ping") |
| 37 | def ping(): |
| 38 | return 'pong' |
| 39 | |
| 40 | app.register_blueprint(setup_bp) |
| 41 | app.register_blueprint(sql_explanation_bp) |
| 42 | app.register_blueprint(sql_gen_bp) |
| 43 | app.register_blueprint(table_selection_bp) |
| 44 | app.register_blueprint(visualization_bp) |
| 45 | |
| 46 | # from app.errors import bp as errors_bp |
| 47 | # app.register_blueprint(errors_bp) |
| 48 | |
| 49 | # from app.main import bp as main_bp |
| 50 | # app.register_blueprint(main_bp) |
| 51 | |
| 52 | @app.teardown_request |
| 53 | def session_clear(exception=None): |
| 54 | db.session.remove() |
| 55 | if exception: |
| 56 | if db.session.is_active: |
| 57 | db.session.rollback() |
| 58 | |
| 59 | return app |
nothing calls this directly
no test coverage detected