I would like to load local data (csv file using pandas) on my dash app, but I get this error:
FileNotFoundError
My data are in the folder ‘data’. This doesn’t work:
server = flask.Flask('congress')
app = dash.Dash('congress', server=server, csrf_protect=False)
server.secret_key = os.environ.get('secret_key', 'secret')
pol = pd.read_csv('data/tweets_pol.csv')
@server.route('/data/<path:path>')
def serve_static(path):
root_dir = os.getcwd()
return flask.send_from_directory(os.path.join(root_dir, 'data'), path)
Any suggestions?