This is an automated email from the ASF dual-hosted git repository.
ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 38b9a81766 Fix static_folder for cli app (#30952)
38b9a81766 is described below
commit 38b9a8176652ae94c6c493a13a6426799b7f2ef4
Author: Jed Cunningham <[email protected]>
AuthorDate: Fri Apr 28 17:31:59 2023 -0500
Fix static_folder for cli app (#30952)
---
airflow/utils/cli_app_builder.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/airflow/utils/cli_app_builder.py b/airflow/utils/cli_app_builder.py
index db2d7f443b..8b0af5c6b0 100644
--- a/airflow/utils/cli_app_builder.py
+++ b/airflow/utils/cli_app_builder.py
@@ -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
@@ -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)