Disable dash instance created before running dash project on dataiku

Siqi
Siqi Registered Posts: 1
edited July 16 in Using 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?

Here is how our project structure looks like:

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

Tagged:

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,090 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.

Setup Info
    Tags
      Help me…