19 lines
497 B
Python
19 lines
497 B
Python
import os
|
|
|
|
from flask import Blueprint
|
|
from flask import current_app as app
|
|
from flask import send_from_directory
|
|
|
|
home_bp = Blueprint("home", __name__)
|
|
|
|
|
|
@home_bp.route("/")
|
|
def serve_root():
|
|
return send_from_directory(app.static_folder, "index.html")
|
|
|
|
|
|
@home_bp.route("/<path:path>")
|
|
def serve_spa(path):
|
|
if os.path.exists(os.path.join(app.static_folder, path)):
|
|
return send_from_directory(app.static_folder, path)
|
|
return send_from_directory(app.static_folder, "index.html")
|