✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

How do I reference a local file when moving to a remote server

I’m trying to deploy my dash app on EBS. I currently reference a local directory (on my machine) as ‘C:\users\me\projects\superstar\assets\database.db’
My dash app.py is in the superstar folder. I’ve tried changing this to ‘/assets/database.db’, but the code is unable to find the file.

Any thoughts would be much appreciated?

Thanks,

Jesse

Try using os.getcwd() and os.path.join() if you are using python.

I hope that helps.

Thanks. I solved it. the problem was the application.py file was in a folder in the project directory ie:
‘\Project\Dash\application.py’ and the database was in \Project\Dash\Assets\name.db. to access the .db file I had to use ‘/Dash/Assets/name.db’ which was confusing for me given the location of the app file.