# Internal Server Error Dash app serving a Flask Server: A name collision occurred between blueprints

**URL:** <https://community.plotly.com/t/internal-server-error-dash-app-serving-a-flask-server-a-name-collision-occurred-between-blueprints/39832>\
**Category:** Dash Python\
**Created:** [May 20, 2020, 7:17pm UTC](https://community.plotly.com/t/internal-server-error-dash-app-serving-a-flask-server-a-name-collision-occurred-between-blueprints/39832 "2020-05-20T19:17:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomwarrens](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@tomwarrens](https://community.plotly.com/u/tomwarrens)\
**Post date:** [May 20, 2020, 7:17pm UTC](https://community.plotly.com/t/internal-server-error-dash-app-serving-a-flask-server-a-name-collision-occurred-between-blueprints/39832/1 "2020-05-20T19:17:55Z")

</div>

I’m working with a Dash App inside a Flask Server.

This is how I instantiate the Flask Server:

```
from flask import Flask, redirect
server = Flask( __name__ , template_folder="../frontend/templates",
               instance_relative_config=True)

```

This is the create\_dash\_app function:

```
import dash
def create_dash_app(server):

    dash_app = dash.Dash(
    __name__ ,
    server=server,
    url_base_pathname='/dash/',
    external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css']
    )

    dash_app.config['suppress_callback_exceptions'] = True

    dash_app.layout = html.H3("Lorem ipsum... ")
    
    return dash_app.server

```

At one of my server routes I have the following:

```
@server.route('/filter')
def filter_stuff():
    
    <some code>
   
    create_dash_app()
    redirect("/dash")

```

The point is that for my use case a user may want to see the dash app, go back to the filter route, apply some filters and check the changings in the dash app.  
Unfortunately, when I do that I get the following:

```
> AssertionError: A name collision occurred between blueprints
> <flask.blueprints.Blueprint object at 0x11905bcd0> and
> <flask.blueprints.Blueprint object at 0x118acbad0>. Both share the
> same name "_dash_dash_assets". Blueprints that are created on the fly
> need unique names.

```

Given my little experience with Flask and Dash I guess it’s something trivial that I’m missing. Please tell me if there is additional info you may need.

EDIT: I’ve found a workaround which I’m ashamed of:

```
from flask import Flask, redirect
from multiprocessing import Value
counter = Value('i', 0)

server = Flask( __name__ , template_folder="../frontend/templates",
               instance_relative_config=True)

@server.route('/filter')
def filter_stuff():
    with counter.get_lock():
        counter.value += 1
        out = counter.value
    <some code>
   
    dash_address = "/dash"+str(out)+"/"
    create_dash_app(server, dash_address)
    
    redirect(dash_address)

import dash
def create_dash_app(server, dash_address):

    dash_app = dash.Dash(
    __name__ ,
    server=server,
    url_base_pathname=dash_address,
    external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css']
    )

    dash_app.config['suppress_callback_exceptions'] = True

    dash_app.layout = html.H3("Lorem ipsum... ")
    
    return dash_app.server

```

As you can see I’m using a counter to redirect to a new page each time. I wonder if some people might die reading this.

Thank you
