Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Multiple user assess to multiple pages but got mutual effect between pages

Hi,

I am trying to duplicate a same app to different instances for different users to use from accessing the same port:
http://localhost:8050/User1/ & http://localhost:8050/User2/

Here is the structure of my implementation, basically I created 2 instances from same app and used Flask:

class App:
        def __init__(self, user, input1, input2):
                self.app = dash.Dash(name=user, requests_pathname_prefix='/{}/'.format(user))
                self.initiate_callbacks()
                self."others"()
        def initiate_callbacks(self):
                self.app.callback(...)
        def "others"(self):
                "create the graphs and get relayData for zooming to update zooming on other graphs"
if __name__ == '__main__':
        flask_app = Flask(__name__)
        @flask_app.route('/')
        def index():
                return 'Welcome web application'
        user1 = App("User1", input1, input2)
        user2 = App("User2", input1, input2)
        print(user1.app.server, user2.app.server)
        application = DispatcherMiddleware(flask_app, {'/User1': user1.app.server,
                                                       '/User2': user2.app.server})
        run_simple('localhost', args.port, application)

By doing this, for some reasons, both instances user1 and user2 have the same relayData so if I zoomed in graph1 (for example) on User1, the graph1 on User2 would be updated based on the relayData from User1’s zooming, vice versa.

My first guess is that 2 apps have the same ID for the components, but some components does not mess with each others between 2 users.

I wonder if there are any hints to work around this, or this DispatcherMiddleware does not work for my purpose. I want to let multiple users access to the app and interact with it independently.

Bests,

1 Like