Skip to content

Commit

Permalink
Make the explorer static files importable
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaelicke committed Jan 9, 2025
1 parent f128b4e commit 8bac920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions metacatalog_api/apps/explorer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from pathlib import Path
from starlette.staticfiles import StaticFiles

static_files = StaticFiles(directory=Path(__file__).parent / "templates" / "static")
3 changes: 2 additions & 1 deletion metacatalog_api/default_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# these imports load the functionality needed for this metacatalog server
from metacatalog_api.apps.explorer.read import templates
from metacatalog_api.apps.explorer import static_files
from metacatalog_api.router.api.read import read_router as api_read_router
from metacatalog_api.router.api.create import create_router as api_create_router
from metacatalog_api.apps.explorer.create import create_router as explorer_create
Expand Down Expand Up @@ -37,7 +38,7 @@ def index(request: Request):
app.include_router(api_create_router)

# add the default explorer application (the HTML)
app.mount(f"{server.app_prefix}static", StaticFiles(directory=Path(__file__).parent / "apps" / "explorer" / "templates" / "static"), name="static")
app.mount(f"{server.app_prefix}static", static_files, name="static")
app.include_router(explorer_router, prefix=f"/{server.app_name}")
app.include_router(explorer_create, prefix=f"/{server.app_name}")

Expand Down

0 comments on commit 8bac920

Please sign in to comment.