Skip to content

Commit

Permalink
Fix static_folder for cli app (#30952)
Browse files Browse the repository at this point in the history
(cherry picked from commit 38b9a81)
  • Loading branch information
jedcunningham authored and ephraimbuddy committed Apr 28, 2023
1 parent 07272b6 commit af9ca33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion airflow/utils/cli_app_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

from __future__ import annotations

import os
from contextlib import contextmanager
from functools import lru_cache
from typing import Generator

from flask import Flask

import airflow
from airflow.www.extensions.init_appbuilder import AirflowAppBuilder, init_appbuilder
from airflow.www.extensions.init_views import init_plugins

Expand All @@ -37,6 +39,7 @@ def _return_appbuilder(app: Flask) -> AirflowAppBuilder:

@contextmanager
def get_application_builder() -> Generator[AirflowAppBuilder, None, None]:
flask_app = Flask(__name__)
static_folder = os.path.join(os.path.dirname(airflow.__file__), "www", "static")
flask_app = Flask(__name__, static_folder=static_folder)
with flask_app.app_context():
yield _return_appbuilder(flask_app)

0 comments on commit af9ca33

Please sign in to comment.