Youāre welcome - on re-reading my stream of thoughts it may have come across more negatively than I intended. So I want to be clear that there are some great aspects to them, and I would like to see some more videos on the more technical aspects of dash, and Iām sure that kind of content is very useful for a lot of people.
Iād like to check - to avoid loading data for all pages every time the server is run, itād be best to load data on individual page refresh?
e.g. if I have 20 pages, Iād want to avoid loading data in all 20 pages everytime i run app.run_server
, right?
I put the dcc.store in the app.py page so changing pages does not trigger a collection
Is the new multi-page app compatible with long callbacks? Iāve seen the warnings about circular imports of app
, but I donāt believe there is a @dash.long_callback equivalent of @dash.callback.
In my content .py file under /pages directory, I also tried the following, however the input object to the callback cannot be found.
app = dash.get_app()
@app.long_callback(...)
def my_callback():
pass
hi @TimW Tim,
welcome to the Dash community.
Currently this is not possible, however, this should change within one week. With the new Dash release, this will be possible. Stay tuned.
I notice dcc_link() and dcc_location() are in Dash v1.1.2 for Julia. I realize Python is where the community is at and this is where the excitement is. I use Julia because of its typing and performance for large datasets. Could you roughly describe how much work it would be if a contributor were to bring multiple pages to Dash.jl?
hi Kirby,
Thank you for your interest and the suggestion. I wrote you a private message to continue the conversation there.
Instantiating Dash (app
variable) with use_pages = True
takes quite long before the Flask app is served. I guess as this is necessary to traverse the pages
folder to find which pages to use. Iāve tested it, and itās 3 seconds vs ~35 seconds (should be dependent on how many pages/folders present.)
Is there any way to speed this up?
Hi @etjkai
If you are checking the performance of the app and just running it with use_pages=True
, or use_pages=False
then yes I would expect to see a performance difference, especially if you have many pages in the pages folder, or certain pages are slow to load.
However I would expect similar performance if you compare the app with use_pages=True
, and an app made the āoldā way with manually importing each layout from the pages folder and creating the callback for the routing of each layout.
There may be ways to speed up the performance, but it would be helpful if you could narrow down which files are the slowest to load.
Understandable - it does make sense to me. Wondering if thereās any way to filter down the files that it looks through - would hate it if the app is looking through the pesky pycache folders that are autogenerated.
Will try to remove all but 1 page, and see how that improves loading speeds.
In either 2.5.1 or 2.6 any files that begin with .
are excluded, so that shouldnāt be an issue
It seems like itās the way Iām loading my initial data files that is the cause of the slownessā¦
On a related, but separate note, is there anyway to use cProfile with Dash with pages? My app runs fine normally, but when I use python -m cProfile app.py
, it shows an error
Exception:
A folder called pages does not exist.
If a folder for pages is not required in your application, set `pages_folder=""`
For example, `app = Dash(__name__, pages_folder="")
I do have a pages
folder present, so Iām not too sure how to proceed from this.