📣 Introducing Dash `/pages` - A Dash 2.x Feature Preview

*** UPDATE ***

While my answer below might work, it’s not the right way. Please see the correct solution in this post:



Original answer -(don’t do it this way - see above)

Hi @Harsha_Dreamer

I haven’t tried making an exe file from a pages app, but here is how you can make it so dash does not look for the pages folder. Basically, you do this by registering each page in app.py instead of from within the pages folder.

Note - this will only work ind dash>=2.5.1

Assuming you have a project structure that looks like this:

- app.py
- pages
    |-page1
    |-page2
  1. Remove dash.register_page(__name__) from pages.page1 and pages.page2

  2. Then in app.py, import each page:

from pages import page1, page2
  1. Register the page in app.py. You will have to assign the layout and give each a unique module name rather than using __name__ ,
dash.register_page("page1", path="/", layout=page1.layout)
dash.register_page("page2, layout=page2.layout)
  1. Set the name of the pages folder to ""
app = dash.Dash(__name__, use_pages=True, pages_folder="")

Please let me know if this works for you and it’s possible to create an exe file.

1 Like