Created
September 2, 2019 13:30
-
-
Save ashb/7be22f075e569de76f6e4a553cbb1b1e to your computer and use it in GitHub Desktop.
Serving custom static files form Airflow Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Blueprint | |
import os | |
""" | |
Create this file as ./plugins/staticfiles.py in your ARIFLOW_HOME directory | |
It will serve all files under ./static/ available under /a/static/ (The "a" comes from the ``url_prefix`` argument.) | |
""" | |
bp = Blueprint( | |
"test_plugin", __name__, | |
url_prefix="/a", | |
static_folder=os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'static')), | |
static_url_path='/static') | |
class StaticPlugin(AirflowPlugin): | |
name = "themes" | |
flask_blueprints = [bp] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment