title: URL of a wsgi_app Flask app using DispatcherMiddleware
body: <p>I have two application factory functions - one creates the "customer" app, and the other creates the "admin" backend app. Both of the factory functions essentially do what is described <a href="https://github.com/miguelgrinberg/flasky/blob/master/app/__init__.py" rel="nofollow noreferrer">here</a> - create a flask app and register some extensions to it and then add some blueprints(with a url_prefix). I glue the two apps together via the <code>create_combined_app()</code> from below. It is the return value of that function which I register with my Flask-Script's <code>Manager</code>.</p>
  
  <pre><code>def create_combined_app(config_name):
      customer_app = create_customer_app(config_name)
      admin_app = create_admin_app(config_name)
  
      from werkzeug.wsgi import DispatcherMiddleware
  
      customer_app.wsgi_app = DispatcherMiddleware(customer_app.wsgi_app, {
          '/admin': admin_app
      })
  
      return customer_app
  </code></pre>
  
  <p>And then this is how I run it.</p>
  
  <pre><code>def make_me_an_app():
      return create_combined_app(config)
  
  manager = Manager(make_me_an_app)
  ...
  
  if __name__ == '__main__':
      manager.run()
  </code></pre>
  
  <p>I want to do some testing which involves getting all GET routes of my app and making sure they load. I followed the example from <a href="https://stackoverflow.com/questions/13151161/display-links-to-new-webpages-created/13161594#13161594">here</a>, but I only see the urls of the <strong>customer</strong> app, and none of the urls from the <strong>admin</strong> backend.</p>
  
  <pre><code>@main.route("/site-map")
  def site_map():
      from flask import current_app, jsonify
      links = []
      app = current_app
      for rule in app.url_map.iter_rules():
          if "GET" in rule.methods and has_no_empty_params(rule):
              url = url_for(rule.endpoint, **(rule.defaults or {}))
              links.append((url, rule.endpoint))
      return jsonify(links)
  </code></pre>
  
  <p>The admin backend works when I try to access it from the browser - it all works nicely, except that I don't see the admin's urls when I call /site-map.</p>
  
  <p>Thanks! :)</p>