Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
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
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.