Trouble with Dash app loading

Follow

Comments

2 comments

  • Jaclyn Patterson

    To get the Dash app to load properly add the following code:

    app.config.update({
    #### as the proxy server may remove the prefix
    'routes_pathname_prefix': '',
    
    #### the front-end will prefix this string to the requests
    #### that are made to the proxy server
    'requests_pathname_prefix': ''
    })
    

    If you are having trouble getting your CSS to work you may need to set an external path to it. Here is the code to do that if it's stored in an assets folder:

    import os
    
    runID = os.environ['DOMINO_RUN_ID']
    user = os.environ['DOMINO_PROJECT_OWNER']
    project = os.environ['DOMINO_PROJECT_NAME']
    
    assets_path = '<Domino url>'+ user + '/' + project +'/r/notebookSession/' + runID + '/assets/'
    
    #set the external path to the assets folder
    app = dash.Dash(assets_external_path = assets_path)
    


    Submitted by: andrea.lowe

    0
    Comment actions Permalink
  • Jaclyn Patterson

    For Dash version 1.3.x+ you may need to set

    app.config.update({
        'routes_pathname_prefix': '',
        'requests_pathname_prefix': '/{}/{}/r/notebookSession/{}/'.format(
            os.environ.get("DOMINO_PROJECT_OWNER"),
            os.environ.get("DOMINO_PROJECT_NAME"),
            os.environ.get("DOMINO_RUN_ID"))
    })
    

    in your main app file (e.g. app.py) otherwise you'll get an error in the browser console saying something like Uncaught Error: Given action "SET_LAYOUT", reducer "layout" returned undefined.

    (Note you'll also want to `import os` if your script doesn't import it already.)

    Submitted by: terry.stebbens

    0
    Comment actions Permalink

Please sign in to leave a comment.