2023-12-28 15:33:41 -06:00
|
|
|
"""Serve static files from the instance directory.
|
|
|
|
|
|
|
|
SPDX-FileCopyrightText: © 2022 Brian S. Stephan <bss@incorporeal.org>
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
"""
|
2022-12-31 10:51:36 -06:00
|
|
|
import os
|
|
|
|
|
|
|
|
from flask import Blueprint
|
|
|
|
from flask import current_app as app
|
|
|
|
from flask import send_from_directory
|
|
|
|
|
|
|
|
bp = Blueprint('static', __name__, url_prefix='/custom-static')
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route('/<path:name>')
|
|
|
|
def serve_instance_static_file(name):
|
|
|
|
"""Serve a static file from the instance directory, used for customization."""
|
|
|
|
return send_from_directory(os.path.join(app.instance_path, 'custom-static'), name)
|