#plotlydash — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #plotlydash, aggregated by home.social.
-
TIL: Plotly Dash uses the order of the pages in the pages registry to evaluate whether the requested URL matches a page's `path_template` value. By default, pages are ordered alphabetically based on the pages filename.
In my case, I had two pages defined with the following `path_template` values:
- `/datasets/<dataset_id>` in `pages/dataset.py`
- `/datasets/<dataset_id>/labelsets/<labelset_id>` in `pages/labelset.py`When trying to open a URL matching the second template, it was matching the first one and using the remainder of the URL as `dataset_id`.
Setting the `order` parameter in the `dash.register_page()` function changes the order of the pages in the page registry, thus changing the path matching order. To match the longest/nested `path_template`, the corresponding page has to be registered with a lower `order` value.
That makes sense in hindsight but the docs do not mention that the path evaluation is affected by the page order.
-
📊🚀 Zajímá vás tvorba interaktivních datových aplikací? Přijďte na workshop "Interaktivní (nejen) datové aplikace s Plotly Dash" vedený Martinem Rapavým! 👨💻🤩 https://cz.pycon.org/2023/program/workshops/23/
#PlotlyDash #PythonWorkshop