forked from DataScienceResearchPeru/epidemiologic-calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (27 loc) · 944 Bytes
/
main.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
35
36
37
38
39
import jinja2
from environment_config import EnvironmentConfig
from flask import Flask
from web.configuration import configure_web_route
from api.routes import api_bp
templates_folders = [
EnvironmentConfig.TEMPLATE_DIR,
]
ROUTING_MODULES = [
configure_web_route
]
def create_app(templates_folders_list=templates_folders):
application = Flask(__name__)
application.register_blueprint(api_bp)
application.config['SECRET_KEY'] = EnvironmentConfig.SECRET_KEY
application.config['TESTING'] = True
for routing in ROUTING_MODULES:
routing(application)
custom_loader = jinja2.ChoiceLoader([
application.jinja_loader,
jinja2.FileSystemLoader(templates_folders_list)
])
application.jinja_loader = custom_loader
return application
app = create_app()
if __name__ == '__main__':
app.run(host='127.0.0.1', port=EnvironmentConfig.PORT, debug=EnvironmentConfig.MODE_DEBUGGER)