Using flask route with dash app on rsconnect

I am using flask routes to download a text file within my dash app. This works locally in my test environment, however when I deploy my app on rsconnect, the download link does not work (route does not work) and I get 404 error. Any idea how to overcome this issue?

    Output('download-link-button', 'href'), 
def update_link(value):
    csv_file = df[value].to_csv(columns=['v1','v2']).replace('\n', '<br>').replace('&', '<amp;>')                             
    return f'/dash/urlToDownload?value={csv_file}'

def download_csv():
    value = flask.request.args.get('value')
    strIO = io.StringIO()
    strIO.write(value.replace("<br>", '\n')
        .replace('<amp;>', '&')
    mem = io.BytesIO()
    return flask.send_file(mem,

Thanks for reaching out here! And welcome to RStudio Community! I have to admit a bit of flask ignorance, personally. Where does @server come from?

Have you seen the examples here?

Does @app.route() work? That seems to be the pattern more in-use there. If I'm right at my guess that @server is a higher level reference, it might be interfering with our bootstrapping of the application.

I am making a note to take a look at this more deeply though :grinning_face_with_smiling_eyes:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.