Disable dash instance created before running dash project on dataiku

Siqi
Level 1
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? 

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

 

 

0 Kudos
1 Reply
Turribeach

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.

0 Kudos

Labels

?
Labels (2)
A banner prompting to get Dataiku