skrawcz commented on code in PR #1488:
URL: https://github.com/apache/hamilton/pull/1488#discussion_r2867982758
##########
ui/backend/server/server/urls.py:
##########
@@ -47,9 +46,45 @@
urlpatterns = [
path("api/", api.api.urls),
path("admin/", admin.site.urls),
- re_path(r"^logo\.png$", serve, {"document_root": settings.MEDIA_ROOT,
"path": "logo.png"}),
- re_path(".*", TemplateView.as_view(template_name="index.html")),
- ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+ ]
+
+ # Serve root-level assets from build/ directory
+ build_dir = settings.BASE_DIR / "build"
+ root_assets = [
+ "manifest.json",
+ "robots.txt",
+ "favicon.png",
+ "favicon.ico",
+ "logo.png",
+ "logo_with_text.svg",
+ ]
+ for asset in root_assets:
+ if (build_dir / asset).exists():
+ urlpatterns.append(
+ re_path(rf"^{asset}$", serve, {"document_root":
str(build_dir), "path": asset})
+ )
+
+ # Serve static assets from build/assets/ (Vite) or build/static/ (CRA)
+ # This MUST come before the catch-all route
+ if (settings.BASE_DIR / "build/assets/").exists():
Review Comment:
i'll fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]