dschandra commited on
Commit
45dfbda
·
verified ·
1 Parent(s): 07005ce

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ from live_scoring import get_live_scores
3
+ from scorecard import get_scorecard
4
+ from leaderboards import get_leaderboards
5
+ from tournament_organizer import organize_tournament
6
+ from looking import lookup_player_team_umpire
7
+
8
+ app = Flask(__name__)
9
+
10
+ @app.route('/')
11
+ def home():
12
+ return render_template('index.html')
13
+
14
+ @app.route('/live_scoring', methods=['GET'])
15
+ def live_scoring():
16
+ scores = get_live_scores()
17
+ return render_template('live_scoring.html', scores=scores)
18
+
19
+ @app.route('/scorecard', methods=['GET'])
20
+ def scorecard():
21
+ player_scores = get_scorecard()
22
+ return render_template('scorecard.html', player_scores=player_scores)
23
+
24
+ @app.route('/leaderboards', methods=['GET'])
25
+ def leaderboards():
26
+ rankings = get_leaderboards()
27
+ return render_template('leaderboards.html', rankings=rankings)
28
+
29
+ @app.route('/tournament', methods=['GET', 'POST'])
30
+ def tournament():
31
+ if request.method == 'POST':
32
+ tournament_details = request.form
33
+ organize_tournament(tournament_details)
34
+ return render_template('tournament_organizer.html')
35
+
36
+ @app.route('/lookup', methods=['GET'])
37
+ def lookup():
38
+ query = request.args.get('query')
39
+ result = lookup_player_team_umpire(query)
40
+ return render_template('lookup.html', result=result)
41
+
42
+ if __name__ == '__main__':
43
+ app.run(debug=True)