0

I am trying to run a Flask app locally which also needs to access resources run on a separate Flask app deployed on a remote server on the local network. I thought this may be possible using a DispatcherMiddleware layer locally, so, based on examples from:

Both examples require the DispatcherMiddleware layer (running locally) to have access to the constituent apps (which may be on a remote server) for example:

from app import app as app1
from app2.app import app as app2
from app3.app import app as app3

application = DispatcherMiddleware(app1, {
    '/app2':    app2, ##may be remote
    '/app3':    app3  ##may be remote
})

Is there any way to achieve this pattern given the distributed apps, short of creating a network share mounting the path to the remote server and importing over a network share?

Community
  • 1
  • 1
pyhelp
  • 11
  • 1
  • 1

1 Answers1

0

DispatcherMiddleware is for serving multiple WSGI applications (like Flask) with one WSGI server (like Gunicorn). The WSGI server runs the app(s), the web server (like Nginx) passes requests to the WSGI server.

If your apps are distributed, then they would be run on their own machines. A WSGI server (and software in general) can't run things on other machines. Using DispatcherMiddleware makes no sense for that.

davidism
  • 121,510
  • 29
  • 395
  • 339