Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Access files on Heroku?

Tags:

python

heroku

I have a project on Heroku. This project allows me to update a JSON file. If update something on Heroku via the project's web interface I see the update. I can close the browser, open it again and the update persists.

Now, I want to push something to this project. If I do, the JSON file will be overwritten. So, I pulled first to get the current project state from heroku. Heroku's prompt says that everything is up to date, which is not true since I changed the JSON file.

Using heroku run ls static/json/ shows the changed file. I need to get this file before pushing to heroku to avoid destroying updates done via the web interface.

like image 634
Merlin Avatar asked Oct 06 '12 20:10

Merlin


1 Answers

I don't think this is possible, for one reason: A Heroku dyno has it's own ephemeral filesystem with a git checkout of the most recent code. It cannot go the other way around however, it's not possible to check file changes in the dyno in into the git repo. This is why you get the response 'Already up-to-date.' when trying to pull, because the heroku git remote is inn sync with your local repo.

You should maybe store your file on Amazon's S3 or in a database or even write your data to a database, so that it is persisted between heroku deployments.

like image 185
Thomas Klemm Avatar answered Sep 30 '22 14:09

Thomas Klemm