I'm trying to use Heroku to deploy my Dash app, which is supposed to read data from a local CSV file. The deployment was successful, but if I open the URL of the app, it gives me an Application Error.
I have checked the Heroku logs and I found a FileNotFoundError
which tells me the CSV file from which the app reads the data does not exist, but it works if I run the app locally. In fact, the CSV file exists in my directory, so I want to know if there's another way to go about this.
EDIT: Actually, this is how my app.py
code starts. The FileNotFoundError
points to the part where I read the CSV file with pandas
.
How can I get my app to read the CSV file?
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table as tablefrom
from dash.dependencies import Input, Output
import plotly as py
import plotly.graph_objs as go
import numpy as np
import pandas as pd
filepath='C:\\Users\\DELL\\Desktop\\EDUCATE\\DATA CSV\\crop_prod_estimates_GH.csv'
data=pd.read_csv(filepath,sep=',',thousands=',')
data.dropna(inplace=True)
data[['REGION','DISTRICT','CROP']]=data[['REGION','DISTRICT','CROP']].astype('category')
data.CROP=data.CROP.str.strip()
data.drop(data.columns[0],axis=1,inplace=True)