I have a python script which I only need to run once (I don't want to have to commit it to the repo to send to the Cedar instance).
The Script aggregates data over my Django models and outputs a .csv file.
Normally in AWS, I would scp
the script to the server, manage.py shell < script.py
, and scp
the produced .csv back to my machine.
I understand Heroku file systems are ephemeral, but is there a way to retrieve produced files on Heroku servers without uploading them to S3?
Here's my best shot:
cat script.py | heroku run manage.py shell --app appname
Works for a one line script, but not with line breaks.
Also, the above script will only produce command line output, not return a .csv file.
Heroku runs your app in a dyno — a smart, secure container with your choice of Python version. Dynos come in different types, ranging from free dynos for getting started, to dynos at $7 per month for hobby projects, all the way to dedicated types for your highest-traffic apps.
To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.
Heroku doesn't give you write permissions anywhere on your dyno (the only files it writes are the ones it checks out from your master branch when you push an update, and any dependencies). You'll have to upload your output to S3, save it to the log, or find some other delivery mechanism (email?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With