Total Complexity | 1 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from quart import Quart, render_template |
||
2 | |||
3 | from .bot import bot_blueprint |
||
4 | from .site.routes import site_blueprint |
||
5 | |||
6 | |||
7 | def create_app(): |
||
8 | """ |
||
9 | Create app |
||
10 | """ |
||
11 | |||
12 | new_app = Quart(__name__) |
||
13 | new_app.register_blueprint(bot_blueprint, url_prefix="/bot") |
||
14 | new_app.register_blueprint(site_blueprint, url_prefix="/site") |
||
15 | new_app.debug = False |
||
16 | |||
17 | @new_app.errorhandler(404) |
||
18 | async def page_not_found(_): |
||
19 | return await render_template("404.html"), 404 |
||
20 | |||
21 | @new_app.route("/", methods=["GET"]) |
||
22 | @new_app.route("/index") |
||
23 | async def index(): |
||
24 | """ |
||
25 | example endpoint |
||
26 | """ |
||
27 | return await render_template("index.html") |
||
28 | |||
29 | return new_app |
||
30 | |||
31 | |||
32 | if __name__ == "__main__": |
||
33 | app = create_app() |
||
34 | app.run() |
||
35 |