-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_app.py
34 lines (26 loc) · 1.06 KB
/
create_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pathlib
from http import HTTPStatus
import quart_flask_patch
from patch_old import placeholder
from oauth import init_oauth
# noinspection PyUnresolvedReferences
from quart import Quart
from service.manager import PluginService
from helpers import LocatePluginTypeConvertor, LocatePluginConvertor, internal_error_handler
from blueprints.http_service import Bp as HTTPService
from blueprints.legacy import Bp as LegacyAPI
from blueprints.ws_status import Bp as ServiceWS
placeholder()
def create_app():
app = Quart(__name__, instance_path=str(pathlib.Path('./instance').absolute()))
app.config.from_prefixed_env()
app.after_serving(PluginService.save)
# noinspection SpellCheckingInspection
app.url_map.converters['ltype'] = LocatePluginTypeConvertor
app.url_map.converters['plugin'] = LocatePluginConvertor
app.register_error_handler(HTTPStatus.INTERNAL_SERVER_ERROR, internal_error_handler)
app.register_blueprint(LegacyAPI)
app.register_blueprint(ServiceWS)
app.register_blueprint(HTTPService)
init_oauth(app)
return app