16 lines
471 B
Python
16 lines
471 B
Python
import os
|
|
|
|
from flask import Blueprint, jsonify, send_from_directory, current_app as app
|
|
|
|
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')
|