Disable dash instance created before running dash project on dataiku
Hello,
I have developped a dash web-app using Dash packag, and it works well locally. However, once I have uploaded it to Dataiku, it is not working as expected.
My question is: how should I remove the "app = dash.Dash(...)" instance defined in dataiku? Is there a way to disable it and enable the dash instance declared in my codes?
dataiku-project/ âââ app.py âââ dashboard/ â âââ assets/ â â âââ Icon.svg â âââ content.py â âââ index.py â âââ layout/ â âââ callbacks/ â â âââ displayPageCallbacks.py â âââ dataUpload.py âââ environment.yml âââ Procfile âââ README.md
In the `index.py` file, there is an dash instance created already:
# index.py from dash import Dash import dash_bootstrap_components as dbc external_stylesheets = [dbc.themes.BOOTSTRAP] app = Dash( __name__, suppress_callback_exceptions=True, external_stylesheets=external_stylesheets, ) app_title = "My Project" app.title = app_title
and this instance will be called for each other elements to compose our dashboard, for example "@app.callbacks(...)" in the other files.
Locally, we just need to run the `app.py` file:
# app.py from dashboard.content import app server = app.server if __name__ == "__main__": app.run_server(debug=True)
which will call the app from the content.py with "app.layout" defined there:
# content.py from dashboard.index import app from dashboard.layout.callbacks import displayPageCallbacks from dash import html, dcc, Input, Output import dash_bootstrap_components as dbc navbar = dbc.NavbarSimple( children=[ dbc.NavItem(dbc.NavLink("Home", href="/")), dbc.NavItem(dbc.NavLink("Data upload", href="/data_upload")), ], brand="My Project", color="dark", dark=True, className="mb-2", ) app.layout = html.Div( [ dcc.Location(id="url", refresh=False), navbar, dbc.Container(id="page-content", className="mb-4", fluid=True), ] )
Best regards,
Operating system used: Windows 10
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,167 Neuron
While I don't have the answer to your question I would recommend a different approach. Start by creating the Dash app on this Tutorial and verify that's working as per the example. Then slowly start to modify it adding the code from your external App. By following this process you will be able to see what changes cause the Webapp to fail in Dataiku and take corrective action.