-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
43 lines (29 loc) · 1.32 KB
/
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
35
36
37
38
39
40
41
42
43
import logging
from flask import Flask
from flask.templating import render_template
import config
from views import TeamsAPIView, PartialsAPIView, StatusAPIView
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s]: %(levelname)s : %(message)s'
)
# Settings -----------------------------------------------------------------------------------------
# Flask
app = Flask(__name__)
app.config.from_object(config)
# App ----------------------------------------------------------------------------------------------
@app.route('/')
def index():
return render_template('index.html')
status_view = StatusAPIView.as_view('status')
teams_view = TeamsAPIView.as_view('times')
partials_view = PartialsAPIView.as_view('parciais')
app.add_url_rule('/status/', view_func=status_view, methods=['GET'])
app.add_url_rule('/times/', defaults={'slug': None}, view_func=teams_view, methods=['GET'])
app.add_url_rule('/times/<string:slug>/', view_func=teams_view, methods=['GET'])
app.add_url_rule('/times/<string:slug>/parciais/', view_func=partials_view, methods=['GET'])
#===================================================================================================
# __main__
#===================================================================================================
if __name__ == '__main__':
app.run(host='0.0.0.0')