plotlydash-flask-tutorial icon indicating copy to clipboard operation
plotlydash-flask-tutorial copied to clipboard

How to add more /dashapp/ views?

Open satrio-yudhoatmojo opened this issue 4 years ago • 3 comments

Hi, your tutorial is very good! I have a question. Let's say I want to build a view for showing data and it's a different view than the dashboard (/dashapp/) - let's say it goes to /dashapp/summary. How do I do this?

satrio-yudhoatmojo avatar Feb 06 '21 06:02 satrio-yudhoatmojo

same doubt here

capihacendado avatar Feb 10 '21 13:02 capihacendado

Well actually I just did a work around to achieve it, and hopefully if there is a more clean way to do it, just let me know.

What I did is:

  • To create another .py file with another dashboard
  • In your init must import this .py and and use the function just like the example shows you

`

    from .plotydash.dashboard import init_dashboard
    from .plotydash.dashboard2 import init_dashboard as in_2
    app = init_dashboard(app)
    app = in_2(app)

`

  • Also to need to create a link in the jinja2 that point the desired url

if you don't want to create new .py you can create and import another function inside the dashboard.py that create another dashboard.

Hope it helps and if there is a better solution please let it know

capihacendado avatar Feb 10 '21 13:02 capihacendado

Do you have to use the jinja2 ? I've never messed with them before. Could you build a cascade of jinja2's, one underneath another? Say for instance you have a bunch of incubators and you want to show the current temperature and humidity but once you click on one of these you would open up your dashboard for that incubator.

hansendm avatar Jul 19 '21 16:07 hansendm