-
-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
As described in https://dash.plot.ly/integrating-dash and seen in code examples posted to our community forum, Dash for Python permits app developers to leverage Flask support for adding new routes.
Dash.jl currently lacks this functionality; sample code in Dash for Python looks like this:
@app.callback(Output('my-link', 'href'), [Input('my-dropdown', 'value')])
def update_link(value):
return '/dash/urlToDownload?value={}'.format(value)
@app.server.route('/dash/urlToDownload')
def download_csv():
value = flask.request.args.get('value')
# create a dynamic csv or file here using `StringIO`
# (instead of writing to the file system)
strIO = StringIO.StringIO()
strIO.write('You have selected {}'.format(value))
strIO.seek(0)
return send_file(strIO,
mimetype='text/csv',
attachment_filename='downloadFile.csv',
as_attachment=True)
User-defined routes are helpful generally, but particularly for documentation and applications where URL redirects are required.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels