Dev-iL commented on code in PR #1488:
URL: https://github.com/apache/hamilton/pull/1488#discussion_r2867965269
##########
contrib/docs/docs/README.md:
##########
Review Comment:
I hope the license header checkers won't mind this
##########
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:
(here and in similar expressions below)
You can use `build_dir` to make this expression shorter (or even turn it
into a constant - BUILD_DIR)
--
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]