I am giving a try to Dash, but I am having issues deploying it to pythonanywhere.com.
I continue to get the Dash callback error every time. I saw a solution for heroku but it has not worked for me.
I am not an experienced programmer, but I have been playing with plotly lately; I think it is a great tool. I really want this to work as I would like my organization to buy some licenses in the future.
I would appreciate any help you can give me.
Below is the code and the error:
--------------------------------------------------------
Error:
2017-07-24 18:08:07,221: Error running WSGI application
2017-07-24 18:08:07,222: TypeError: 'Dash' object is not callable
--------
dashapp.py
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
from flask import Flask
from dash.dependencies import Input, Output
server = Flask(__name__)
server.secret_key ='test'
#server.secret_key = os.environ.get('secret_key', 'secret')
app = dash.Dash(name = __name__, server = server)
app.config.supress_callback_exceptions = True
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
),
dcc.Input(id='my-id', value='initial value', type="text"),
html.Div(id='my-div')
])
@app.callback(
Output(component_id='my-div', component_property='children'),
[Input(component_id='my-id', component_property='value')]
)
def update_output_div(input_value):
return 'You\'ve entered "{}"'.format(input_value)
wsgi
import sys
path = '/home/******/******'
if path not in sys.path:
sys.path.append(path)
from dashapp import app as application