| Total Complexity | 1 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from flask import Flask, render_template |
||
| 2 | from flask_bootstrap import Bootstrap |
||
| 3 | |||
| 4 | from app.api.views import blueprints as api_blueprints |
||
| 5 | from app.telegram_bot.routes import bot_routes |
||
| 6 | |||
| 7 | bootstrap = Bootstrap() |
||
| 8 | |||
| 9 | |||
| 10 | def create_app(): |
||
| 11 | """ |
||
| 12 | Create app |
||
| 13 | """ |
||
| 14 | |||
| 15 | # app initialization |
||
| 16 | app = Flask(__name__) |
||
| 17 | |||
| 18 | # bootstrap initialization |
||
| 19 | bootstrap.init_app(app) |
||
| 20 | all_blueprints = [*api_blueprints, bot_routes] |
||
| 21 | # register all blueprints |
||
| 22 | _ = [ |
||
| 23 | app.register_blueprint(bp.get("blueprint"), url_prefix=bp.get("url_prefix")) |
||
| 24 | for bp in all_blueprints |
||
| 25 | ] |
||
| 26 | |||
| 27 | @app.route("/", methods=["GET"]) |
||
| 28 | @app.route("/index") |
||
| 29 | def index(): |
||
| 30 | """ |
||
| 31 | example endpoint |
||
| 32 | """ |
||
| 33 | return render_template("index.html") |
||
| 34 | |||
| 35 | return app |
||
| 36 |