How can I use plotly offline with flask . I know that plotly can be used offline with Ipython notebook , Can I use Plotly offline with flask ? If not , can someone please sugges
Update
@DarenThomas In my usage, I simply import flask and create routes as usual.
import flask
# ... normal Dash stuff here
@app.server.route('/error.csv')
def serve_error():
return flask.send_file('error.csv')
=====================================================================
For those looking in the future, this answer can be updated to include the Plotly side-project Dash. It comes out of the box with plotly/flask support and was extremely easy to get existing plotly graphs to show up in a web interface. For example:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
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'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
See also their tutorial series.