Hosting multiple Dash apps with uWSGI + Nginx

I’m guessing that the problem is that the automatically generated routes for the two dash apps are conflicting with each other. I would expect this to not work if you just tried to run two Dash apps alongside each other. For example both apps would be trying to use /_dash-dependencies.

Setting the url_base_pathname parameter for to something distinct for each app is what you want to do. eg

app1 = Dash(__name__, url_base_pathname='/app1') 

The other thing I’ve seen suggested is to create a Flask instance that routes requests to the Flask instances of the two different apps. Something like this, although I haven’t actually tried it. It’s likely the routes might need some tweaking. The default value for url_base_pathname is ‘/’ so that definitely needs modifying here.

from dash import Dash
from flask import Flask 
from werkzeug.wsgi import DispatcherMiddleware

app1 = Dash(url_base_pathname='')
app2 = Dash(url_base_pathname='')
flask_app = Flask()

app = DispatcherMiddleware(flask_app, {
    '/app1': dash_app1.server,
    '/app2': dash_app2.server,
})
1 Like