When I tried running
heroku run bash python manage.py migrate --app appName
from my terminal using the Heroku CLI, I get below error/response;
/app/.heroku/python/bin/python: /app/.heroku/python/bin/python: cannot execute binary file
CodePudding user response:
I was finally able to get around this by first getting into bash on heroku, then running the command I wish to. Steps are listed below;
- I open my terminal and using the heroku-cli, I ran
heroku run bash --app appName - You should see the bash shell loaded if this execute successfully, looking something like
~ $ - Now go ahead and manually enter your command, in this case
python manage.py migratewhich should work. - Just a tip -- if that doesn't still work (or you're just curious to see your file directory) you can go ahead and list out the different dirs to see where your manage.py file is before going into that correct dir and running your command again. Use
ls -l $(ls)orfind . -maxdepth 3 -type d -lsor simplyls -l
CodePudding user response:
This command doesn't make sense:
heroku run bash python manage.py migrate --app appName
Let's break it down:
heroku run ... --app appNametells Heroku to run the stuff in...on the appappNamepython manage.py migrateis the command you want to run on your dyno:pythonis the executablemanage.pyis the file Python executesmigrateis an argument passed tomanage.py
bash... doesn't do anything useful here
In fact, you are telling Heroku to run bash python manage.py migrate, where you run bash and pass it python manage.py migrate as arguments. Since python is not a shell script, bash cannot execute it.
Lose the bash:
heroku run python manage.py migrate --app appName
