Search code examples
djangoherokudjango-rest-frameworkheroku-cli

/app/.heroku/python/bin/python: /app/.heroku/python/bin/python: cannot execute binary file


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

-- Updated with screenshot --

Even when I tried heroku run python manage.py migrate --app appName without adding bash, I still get an error.

enter image description here


Solution

  • 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;

    1. I open my terminal and using the heroku-cli, I ran heroku run bash --app appName
    2. You should see the bash shell loaded if this execute successfully, looking something like ~ $
    3. Now go ahead and manually enter your command, in this case python manage.py migrate which should work.
    4. 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) or find . -maxdepth 3 -type d -ls or simply ls -l