Skip to content

Commit

Permalink
bug fix: added slash
Browse files Browse the repository at this point in the history
  • Loading branch information
davorrunje committed Oct 8, 2024
1 parent 7f9e8db commit e3cf183
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions fastagency/ui/mesop/mesoptimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
configure_static_file_serving as configure_static_file_serving_original,
)

pp = Path(__file__).parent
# os.path.dirname(__file__)
path_2_js = pp / "counter_component.js"
# path_2_js = os.path.join(pp, "counter_component.js")
# path_2_js = os.path.join(".", "counter_component.js")
# print("dir je:", pp, "u totalu:", path_2_js)
from ...logging import get_logger

logger = get_logger(__name__)


def configure_static_file_serving(
Expand All @@ -30,6 +27,8 @@ def configure_static_file_serving(
disable_gzip_cache: bool = False,
default_allowed_iframe_parents: str = "'self'",
) -> None:
logger.info("Configuring static file serving with patched method")

configure_static_file_serving_original(
app=app,
static_file_runfiles_base=static_file_runfiles_base,
Expand All @@ -41,6 +40,8 @@ def configure_static_file_serving(

@app.route(f"/{WEB_COMPONENTS_PATH_SEGMENT}/__fast_agency_internal__/<path:path>")
def serve_web_components_fast_agency(path: str) -> Response:
logger.info(f"Serve web components fast agency: {path}")

root = Path(__file__).parents[3].resolve()
serving_path = f"{root}/{path}"

Expand All @@ -50,11 +51,11 @@ def serve_web_components_fast_agency(path: str) -> Response:
)


logger.info("Patching static file serving in Mesop")
mesop.server.wsgi_app.configure_static_file_serving = configure_static_file_serving


# @mel.web_component(path=path_2_js)
@mel.web_component(path="__fast_agency_internal__/javascript/counter_component.js") # type: ignore[misc]
@mel.web_component(path="/__fast_agency_internal__/javascript/counter_component.js") # type: ignore[misc]
def counter_component(
*,
value: int,
Expand Down

0 comments on commit e3cf183

Please sign in to comment.