/app/.heroku/python/bin/python: /app/.heroku/python/bin/python: 无法执行二进制文件

发布于 2025-01-13 02:24:34 字数 506 浏览 2 评论 0原文

当我尝试

heroku run bash python manage.py migrate --app appName

使用 Heroku CLI 从终端运行时,出现以下错误/响应;

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

-- 使用屏幕截图更新 --

即使当我尝试 heroku run python manage.py migrate --app appName 而不添加 bash 时,我仍然收到错误。

输入图片此处描述

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

盗心人 2025-01-20 02:24:34

这个命令没有意义:

heroku run bash python manage.py migrate --app appName

让我们分解一下:

  • heroku run ... --app appName 告诉 Heroku 在应用程序上运行 ... 中的内容 < code>appName
  • python manage.py migrate 是您要在 dyno 上运行的命令:
    • python 是可执行文件
    • manage.py是Python执行的文件
    • migrate 是传递给 manage.py
    • 的参数

  • < code>bash...在这里没有做任何有用的事情

事实上,你告诉 Heroku 运行 bash python manage.py migrate,你在其中运行 bash 并将其传递给 python manage.py migrate 作为论据。由于python不是shell脚本,因此bash无法执行它。

失去bash

heroku run python manage.py migrate --app appName

This command doesn't make sense:

heroku run bash python manage.py migrate --app appName

Let's break it down:

  • heroku run ... --app appName tells Heroku to run the stuff in ... on the app appName
  • python manage.py migrate is the command you want to run on your dyno:
    • python is the executable
    • manage.py is the file Python executes
    • migrate is an argument passed to manage.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
喜你已久 2025-01-20 02:24:34

我终于能够通过首先进入heroku上的bash,然后运行我想要的命令来解决这个问题。步骤如下;

  1. 我打开终端并使用 heroku-cli,运行 heroku run bash --app appName
  2. 如果执行成功,您应该会看到 bash shell 已加载,看起来像 ~ $
  3. 现在继续手动输入命令,在本例中 python manage.py migrate 应该可以工作。
  4. 只是一个提示 - 如果这仍然不起作用(或者您只是想看看您的文件目录),您可以继续列出不同的目录,以查看您的 manage.py 文件在哪里,然后再进入正确的目录并再次运行你的命令。使用 ls -l $(ls) 或 find 。 -maxdepth 3 -type d -ls 或简单地 ls -l

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文