dash app deployment issue

Jonson
Level 1
dash app deployment issue

Hello, I am trying to deploy the dash app below, but it shows the error:

 

raise exceptions.NoLayoutException(dash.exceptions.NoLayoutException: The layout was `None` at the time that `run_server` was called.

the dash page def is stored in another file store under "libraries_path +'/pages'", can you please help with this issue? many thanks

 

 

logger = get_logger(__name__)
flask_server = Flask(__name__)

#app.config.external_stylesheets = [dbc.themes.BOOTSTRAP,
#                                  os.path.join(libraries_path, "assets", "styles.css"),                                 
#        "https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap",]

#app.config.external_stylesheets = [os.path.join(libraries_path, "assets", "styles.css")]

    
    
app = dash.Dash(
    __name__,
    pages_folder=libraries_path +'/pages',  
    use_pages=True,
    server=flask_server,
    external_stylesheets=[
        dbc.themes.BOOTSTRAP,
        os.path.join("src", "dashgpt", "assets", "styles.css"),
        "https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap",
    ],
    title="ChatBot",
    suppress_callback_exceptions=True,
)

app.index_string = ("""
    <!DOCTYPE html>
    <html>
    <head>
    {%metas%}
    <title>{%title%}</title>
    {%favicon%}
    {%css%}
    </head>
    <body>
    {%app_entry%}
    <footer>
    {%config%}
    {%scripts%}
    {%renderer%}
    </footer>
    </body>
    </html>
""")

app.layout = html.Div(
    children=[dash.page_container],
    className="container-fluid",
    style={
        "width": "100%",
        "height": "100%",
        "overflow": "hidden",
    },
)

 

 

0 Kudos
1 Reply
VitaliyD
Dataiker

Hi,

The Dash webapp implementation in Dataiku uses a wrapper, so it is not possible to configure the Dash constructor without modifying the wrapper at the moment. Also, if you have a UIF-enabled instance, it is not possible to access assets that can potentially be stored in the project libraries. Other users have asked for this already, so this is added to our backlog as a feature request and can become possible in the feature, but we cannot provide any timeline. As of now, you can only update properties that can be changed on the already initialised Dash app. For example:
app.config.external_stylesheets = ['https://your_styles.css']

From the code, you are looking to create a Dash multipage web app. You can do that by concatenating the code for all pages. Please refer to an example available in Dataiku DSS when creating a new web app.

Screenshot 2024-04-10 at 14.39.25.pngScreenshot 2024-04-10 at 14.39.34.png

Hope this helps.

Best,

Vitaliy