Open vmatos opened 2 years ago
Hi @vmatos
Thanks for providing the repo with the example, I'll see what I can do to make it work with dash-labs, but I expect that it may not work since it's plug-in.
I'm currently working on a PR to move the pages
plug-in to dash. It would be very helpful if you could take the pre-release for a spin and see if you get the same results.
You can find the current pre-release tarball based on my PR here: https://github.com/AnnMarieW/dash-flask-login/tree/dash2.4
pip install dash-2.4.0rc3.tar.gz
change the app instantiation to: app = Dash(__name__, use_pages=True)
change dl.plugins.page_container
, to dash.page_container
,
Thank you @AnnMarieW
I have tested with the rc3 you have provided. The ModuleNotFoundError
remains. You can find in branch: https://github.com/vmatos/minimal_multipage_dispatcher/tree/dash-2.4.0rc3
Also in branch: https://github.com/vmatos/minimal_multipage_dispatcher/tree/pythonpath I try to work around the module importing issue. But I find myself with each Dash
instantiation deleting the previous pages registries.
@vmatos
But I find myself with each Dash instantiation deleting the previous pages registries.
Could you try using unique names in the first attribute of dash.register_page()
, for example in app1:
dash.register_page("another_home1", layout=html.Div("App 1!"), path="/")
Oh, But I did in the other branch.
dash.register_page(__name__+".another_home", layout=html.Div("App 1!"), path='/')
dash.register_page(
__name__+".very_important", layout=html.Div("Don't miss it! 1"), path="/important", order=0
)
In branch https://github.com/vmatos/minimal_multipage_dispatcher/tree/pythonpath-2.4.0rc3 I tried the same hacking of pythonpath to be able to import the modules. On the other hand we dive deep in many other issues that result from differences introduced in this dash version.
Exception: Server already exists
routes_pathname_prefix
. ValueError: The name '_dash_assets' is already registered for a different blueprint. Use 'name=' to provide a unique name.
Exception: modules ['app_one.app.very_important', 'app_two.app.very_important'] have duplicate paths
I looked into this a little more, and I expect that pages
is not compatible with this method. I'll confirm this with the Plotly team and see if they can suggest a work-around.
It may be necessary to use the current pattern for multi-page apps described in the docs Multi-page Apps and URL Support rather than using pages
When I import my Dash application as a module, to be dispatched by werkzeug DispatcherMiddleware, I get the following error:
You can find a minimal replication of the issue in the repository: https://github.com/vmatos/minimal_multipage_dispatcher
Would it be possible to achieve this use case, of having multiple Dash app with the multi-page plugin?