Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying django app to heroku - can't find file

Tags:

django

heroku

I have a problem running my django app on heroku. It has been deployed successfully but it has some problems finding various files.

in news.py

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
url_path = BASE_DIR + '/marketdata/news/'

which works locally but when I deploy it on heroku it says it can't find the file

Exception Value: [Errno 2] No such file or directory: '/app/artemis/static/marketdata/news/bloomberg_news.csv' Exception Location: /app/artemis/static/marketdata/news.py in save_to_csv, line 16

and this is my project structure

enter image description here

Any idea how this would be solved? Any tip would be greatly appreciated!

EDIT: if i check my project structure on heroku the news folder is not there at all. Does this have to do with the fact that it only has .csv files in it?

like image 855
KeykoYume Avatar asked Nov 18 '22 06:11

KeykoYume


1 Answers

I found the solution to the issue I was having:

  • I didn't run python manage.py collectstatic before committing to heroku
  • The other problem was with my procfile. Changing it to: web: gunicorn myproject.wsgi solved my issue
like image 60
KeykoYume Avatar answered Jun 28 '23 06:06

KeykoYume