JupyterDash in a notebook which is running on a remote server

Hi,

I want to run JupyterDash in a Jupyter notebook running on a remote server (I use ssh -L 1234:localhost:1234 and can see the notebook on my browser at http://localhost:1234).

Following the tutorial, I set up the app as

from dash import html
import dash_bio as dashbio
from jupyter_dash import JupyterDash

# JupyterDash.infer_jupyter_proxy_config()

app = JupyterDash(__name__)

with open('seqs.fasta', 'r') as f:
    data = f.read()
app.layout = html.Div([dashbio.AlignmentChart(id="AlignmentChart", data=data)])

app.run_server(mode="external", port=4321, debug=True)

This gives the link Dash app running on http://127.0.0.1:4321/ which does not work as I am not on the remote server. Also, I tried activating the jupyter_server_proxy and uncommenting the JupyterDash.infer_jupyter_proxy_config() line above. In that case, the link would be
Dash app running on http://localhost:1234/proxy/4321/
which does not work either.

The only suboptimal solution I found was to run another ssh with option -L 4321:localhost:4321 and see the app under http://127.0.0.1:4321/.

Obviously, this does not work if you want to use the app in “inline” mode. What’s the correct way of running a JupyterDash app in inline mode on a remote notebook?

Thanks!

I think it is difficult .jupyter server is in tornado but dash is flask. I use _thread.start_new_thread to create the dash application.Then use the Iframe to show my dash app. :joy:

Thanks for your reply.
Can you please share a minimal (pseudo) code for doing that?

Same problem. JupyterDash should setup a proxy automatically. Same problem also with e.g. Gradio.