Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from flask import Flask, send_from_directory
|
| 2 |
|
| 3 |
app = Flask(__name__, static_folder='.', static_url_path='/')
|
| 4 |
|
|
@@ -8,8 +8,14 @@ def index():
|
|
| 8 |
|
| 9 |
@app.route('/league')
|
| 10 |
def league():
|
|
|
|
| 11 |
return send_from_directory('.', 'league.html')
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
@app.route('/league.html')
|
| 14 |
def league_html():
|
| 15 |
# Alias to support environments that request the .html path explicitly
|
|
|
|
| 1 |
+
from flask import Flask, send_from_directory, redirect
|
| 2 |
|
| 3 |
app = Flask(__name__, static_folder='.', static_url_path='/')
|
| 4 |
|
|
|
|
| 8 |
|
| 9 |
@app.route('/league')
|
| 10 |
def league():
|
| 11 |
+
# Serve the league page (alias)
|
| 12 |
return send_from_directory('.', 'league.html')
|
| 13 |
|
| 14 |
+
@app.route('/league/')
|
| 15 |
+
def league_trailing_slash():
|
| 16 |
+
# Redirect trailing slash to canonical path
|
| 17 |
+
return redirect('/league.html')
|
| 18 |
+
|
| 19 |
@app.route('/league.html')
|
| 20 |
def league_html():
|
| 21 |
# Alias to support environments that request the .html path explicitly
|