| Conditions | 1 |
| Total Lines | 33 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from flask import Flask, render_template |
||
| 12 | def create_app(): |
||
| 13 | """ |
||
| 14 | Create app |
||
| 15 | """ |
||
| 16 | |||
| 17 | # app initialization |
||
| 18 | app = Flask(__name__) |
||
| 19 | |||
| 20 | # bootstrap initialization |
||
| 21 | bootstrap.init_app(app) |
||
| 22 | # register all blueprints |
||
| 23 | app.register_blueprint(bot_blueprint, url_prefix="/bot") |
||
| 24 | app.register_blueprint(site_blueprint, url_prefix="/site") |
||
| 25 | |||
| 26 | _ = [ |
||
| 27 | app.register_blueprint(bp.get("blueprint"), url_prefix=bp.get("url_prefix")) |
||
| 28 | for bp in api_blueprints |
||
| 29 | ] |
||
| 30 | app.debug = True |
||
| 31 | |||
| 32 | @app.errorhandler(404) |
||
| 33 | def page_not_found(_): |
||
| 34 | return render_template("404.html"), 404 |
||
| 35 | |||
| 36 | @app.route("/", methods=["GET"]) |
||
| 37 | @app.route("/index") |
||
| 38 | def index(): |
||
| 39 | """ |
||
| 40 | example endpoint |
||
| 41 | """ |
||
| 42 | return render_template("index.html") |
||
| 43 | |||
| 44 | return app |
||
| 45 |