Routing issues Dash + Flask

I have two separate apps:

  1. Flask app:
    flask_app = connexion.App(__name__)

  2. Dash app:
    external_stylesheets = [‘’]
    dash_app = dash.Dash(name, external_stylesheets=external_stylesheets)
    dash_app.layout = html.Div([html.H1(‘This is a base header’)])

Also, I’m working with both of them:

app = DispatcherMiddleware(flask_app, {
            '/reports': dash_app.server

To run my app I’m writing:

More or less it’s OK, but…

When I’m sending GET request to:

I’m getting an error:
[2019-01-02 20:21:01,131] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File “/home/user/app/venv/local/lib/python2.7/site-packages/flask/”, line 2292, in wsgi_app
response = self.full_dispatch_request()
File “/home/user/app/venv/local/lib/python2.7/site-packages/flask/”, line 1808, in full_dispatch_request
File “/home/user/app/venv/local/lib/python2.7/site-packages/flask/”, line 1855, in try_trigger_before_first_request_functions
File “/home/user/app/venv/local/lib/python2.7/site-packages/dash/”, line 994, in _setup_server
File “/home/user/app/venv/local/lib/python2.7/site-packages/dash/”, line 982, in _validate_layout
for component in to_validate.traverse():
AttributeError: ‘Response’ object has no attribute ‘traverse’ - - [02/Jan/2019 20:21:01] “GET /reports/ HTTP/1.1” 500 -

I was trying to play with url_base_pathname, but with no luck ;(

Hi @pivanchy,

Could you change the category of your post from API/Python to Dash? You’ll probably have better luck over there. Thanks!


When you use DispatcherMiddleware to embed a Dash app, you need to modify the requests_pathname_prefix to contain the full prefix including the mount point. So I would try this:

dash_app = dash.Dash( __name__, requests_pathname_prefix='/reports/')

However I haven’t seen that particular error you’re encountering as being associated with omitting this step. If you’re still experiencing issues, could you post a complete, minimal example of the issue?