When running on Windows, with PLOTLY_DASH = {"serve_locally": True}, I get a 404 Not Found HTTP error when requesting any of the static components, eg:
curl -X GET -v http://localhost:8000/static/dash/component/dash/html/dash_html_components.min.js
returns a 404 error page.
This is because DashComponentFinder compares a fragment of URL path (with / separators) against a local filesystem path which on Windows uses \. The comparison fails, so the static files are not served.
The fix is to convert the URL path fragment to match the local system's slash-preference, so that they can be directly compared.
The edit looks a bit like this:
https://github.com/GibbsConsulting/django-plotly-dash/blob/e6dd41ded4fd0236a0b387a59061dc96fce58109/django_plotly_dash/finders.py#L135C1-L136C1
component_path = str(Path("dash/component/%s" % component_name))
This uses pathlib.Path to convert from dash/component/some/url/path to dash\component\some\url\path on Windows, while leaving it unmodified on Linux.
When running on Windows, with
PLOTLY_DASH = {"serve_locally": True}, I get a 404 Not Found HTTP error when requesting any of the static components, eg:curl -X GET -v http://localhost:8000/static/dash/component/dash/html/dash_html_components.min.jsreturns a 404 error page.
This is because
DashComponentFindercompares a fragment of URL path (with/separators) against a local filesystem path which on Windows uses\. The comparison fails, so the static files are not served.The fix is to convert the URL path fragment to match the local system's slash-preference, so that they can be directly compared.
The edit looks a bit like this:
https://github.com/GibbsConsulting/django-plotly-dash/blob/e6dd41ded4fd0236a0b387a59061dc96fce58109/django_plotly_dash/finders.py#L135C1-L136C1
This uses
pathlib.Pathto convert fromdash/component/some/url/pathtodash\component\some\url\pathon Windows, while leaving it unmodified on Linux.