I'm having trouble getting my Dash app to load correctly in Domino. The Problems include the app url just showing loading and my custom css not working. What should I do to get the app to load?
To get the Dash app to load properly add the following code:
#### as the proxy server may remove the prefix
#### the front-end will prefix this string to the requests
#### that are made to the proxy server
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:
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)
For Dash version 1.3.x+ you may need to set
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.
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.)