Hi All,
Firstly, thanks everyone for the great work. We are testing Dash and we had it up and running but started receiving this error after our upgrade to Dash 0.18.1.
AssertionError: View function mapping is overwriting an existing endpoint function: serve_layout
Code that replicates from standard example below. Thanks for your help!
Trace:
Traceback (most recent call last):
File "/home/joe/pycharm/helpers/pydev/pydevd.py", line 1585, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/joe/pycharm/helpers/pydev/pydevd.py", line 1015, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/joe/pycharm/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/joe/PycharmProjects/dash_test/run.py", line 4, in <module>
import app2
File "/home/joe/PycharmProjects/dash_test/app2.py", line 11, in <module>
app = dash.Dash(name='app2', server=server, url_base_pathname='/app2' )
File "/home/joe/.virtualenvs/dash_web_analytics/src/dash/dash/dash.py", line 73, in __init__
view_func=self.serve_layout)
File "/home/joe/.virtualenvs/dash_web_analytics/lib/python3.5/site-packages/flask/app.py", line 64, in wrapper_func
return f(self, *args, **kwargs)
File "/home/joe/.virtualenvs/dash_web_analytics/lib/python3.5/site-packages/flask/app.py", line 1051, in add_url_rule
'existing endpoint function: %s' % endpoint)
AssertionError: View function mapping is overwriting an existing endpoint function: serve_layout
from server import server
import app1
import app2
if __name__ == '__main__':
server.run(debug=True)
from flask import Flask
server = Flask(__name__)
server.secret_key ='asdfasefasedfaswefwasefasdf'
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
from server import server
app = dash.Dash(name='app1', server=server, url_base_pathname='/app1' )
app.layout = html.Div([
html.H3('App 1'),
dcc.Dropdown(
id='app-1-dropdown',
options=[
{'label': 'App 1 - {}'.format(i), 'value': i} for i in [
'NYC', 'MTL', 'LA'
]
],
value='NYC'
),
html.Div(id='app-1-display-value'),
dcc.Link('Go to App 2', href='/app2')
])
@app.callback(
Output('app-1-display-value', 'children'),
[Input('app-1-dropdown', 'value')])
def display_value(value):
return 'You have selected "{}"'.format(value)
from dash.dependencies import Input, Output
import dash
import dash_html_components as html
import dash_core_components as dcc
from server import server
app = dash.Dash(name='app2', server=server, url_base_pathname='/app2' )
app.layout = html.Div([
html.H3('App 2'),
dcc.Dropdown(
id='app-2-dropdown',
options=[
{'label': 'App 2 - {}'.format(i), 'value': i} for i in [
'NYC', 'MTL', 'LA'
]
],
value='NYC'
),
html.Div(id='app-2-display-value'),
dcc.Link('Go to App 1', href='/app1')
])
@app.callback(
Output('app-2-display-value', 'children'),
[Input('app-2-dropdown', 'value')])
def display_value(value):
return 'You have selected "{}"'.format(value)
reqs.txt
certifi==2017.7.27.1
chardet==3.0.4
click==6.7
dash==0.18.1
dash-core-components==0.12.4
dash-html-components==0.7.0
dash-renderer==0.9.0
decorator==4.1.2
Flask==0.12.2
Flask-Compress==1.4.0
Flask-SeaSurf==0.2.2
gevent==1.2.2
greenlet==0.4.12
idna==2.6
ipython-genutils==0.2.0
itsdangerous==0.24
Jinja2==2.9.6
jsonschema==2.6.0
jupyter-core==4.3.0
MarkupSafe==1.0
nbformat==4.4.0
numpy==1.13.1
pandas==0.20.3
pandas-datareader==0.5.0
plotly==2.0.15
PyMySQL==0.7.11
python-dateutil==2.6.1
pytz==2017.2
requests==2.18.4
requests-file==1.4.2
requests-ftp==0.3.1
site==0.0.1
six==1.10.0
SQLAlchemy==1.1.13
traitlets==4.3.2
urllib3==1.22
uWSGI==2.0.15
Werkzeug==0.12.2