Using Sphinx to document a Multipage Dash App

Exploring using Sphinx to document my dash app. I have created a multipage app and am getting issues from Sphinx when trying to use autodocs with the pages.

dash.exceptions.PageError: dash.register_page() must be called after app instantiation

The above occurs due to the app not being instantiated and Sphinx trying to import that file. So I could just comment out that line, but that is not the best work around.

If I do comment out the dash.register_page() line in my pages I still run into issues with functions like get_asset_url which also expects the app to be running.

Temporary Fix? doesn’t feel the safest, but I did the following

    dash.register_page(__name__, path='/')
    print('App is not running so create one')
    app = Dash(__name__,use_pages=False,suppress_callback_exceptions = True)

I feel as if this is not ideal, and is a weird work around. One thing it does prompt me to explore more is the ability to have a page be usable as a page and a standalone app (if not dependent on other pages etc).