File tree 1 file changed +33
-10
lines changed
1 file changed +33
-10
lines changed Original file line number Diff line number Diff line change 4
4
from config .application import config
5
5
from app .http .controllers .api .PredictionController import PredictionController
6
6
7
- app = Flask ( __name__ )
8
- app . config . from_mapping (
9
- ENV = config [ 'env' ],
10
- DEBUG = config [ 'debug' ],
11
- SECRET_KEY = config [ 'key' ]
12
- )
7
+ # -------------------------------------------------------------------------
8
+ # Extension Objects
9
+ # -------------------------------------------------------------------------
10
+ #
11
+ # Initialize extensions accessible to any part of our app
12
+ api = Api ( )
13
13
14
- CORS (app , origins = config ['origins' ])
15
14
16
- api = Api (app )
17
- api .add_resource (PredictionController , '/prediction' )
15
+ def create_app () -> Flask :
16
+ """
17
+ Create The Application
18
+ The first thing we will do is create a new application instance
19
+ which serves as the "glue" for all the components of the api.
20
+ :return: Flask
21
+ """
22
+ app = Flask (__name__ )
18
23
19
- __version__ = "0.1"
24
+ app .config .from_mapping (
25
+ ENV = config ['env' ],
26
+ DEBUG = config ['debug' ],
27
+ SECRET_KEY = config ['key' ]
28
+ )
29
+
30
+ CORS (app , origins = config ['origins' ])
31
+
32
+ # Initialize Extensions
33
+ api .init_app (app )
34
+
35
+ with app .app_context ():
36
+ # Register resources
37
+ api .add_resource (PredictionController , '/prediction' )
38
+
39
+ return app
40
+
41
+
42
+ __version__ = "0.1.0"
You can’t perform that action at this time.
0 commit comments