from flask import Flask, render_template, request from live_scoring import get_live_scores from scorecard import get_scorecard from leaderboards import get_leaderboards from tournament_organizer import organize_tournament from looking import lookup_player_team_umpire app = Flask(__name__) @app.route('/test') def test(): return "App is running!" @app.route('/') def home(): return render_template('index.html') @app.route('/live_scoring', methods=['GET']) def live_scoring(): scores = get_live_scores() return render_template('live_scoring.html', scores=scores) @app.route('/scorecard', methods=['GET']) def scorecard(): player_scores = get_scorecard() return render_template('scorecard.html', player_scores=player_scores) @app.route('/leaderboards', methods=['GET']) def leaderboards(): rankings = get_leaderboards() return render_template('leaderboards.html', rankings=rankings) @app.route('/tournament', methods=['GET', 'POST']) def tournament(): if request.method == 'POST': tournament_details = request.form organize_tournament(tournament_details) return render_template('tournament_organizer.html') @app.route('/lookup', methods=['GET']) def lookup(): query = request.args.get('query') result = lookup_player_team_umpire(query) return render_template('lookup.html', result=result) if __name__ == '__main__': app.run(debug=True, host='127.0.0.1', port=5001) # Custom port number