【问题标题】:Heroku not recognizing migrationsHeroku 无法识别迁移
【发布时间】:2021-12-14 13:57:15
【问题描述】:

我终于让我的 Heroku 应用程序至少在本地工作了!但是,当我尝试在线打开它时,它会崩溃并出现以下错误:

>     2021-10-29T13:16:54.435118+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of
> launch
>     2021-10-29T13:16:56.287092+00:00 heroku[web.1]: Stopping process with SIGKILL
>     2021-10-29T13:16:56.458881+00:00 heroku[web.1]: Process exited with status 137
>     2021-10-29T13:16:56.499621+00:00 heroku[web.1]: State changed from starting to crashed
>     2021-10-29T13:17:13.107001+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"
> host=shrouded-bastion-04661.herokuapp.com
> request_id=81455b66-dab8-4b20-9c69-91b73739a09a fwd="71.231.14.146"
> dyno= connect= service= status=503 bytes= protocol=https
>     2021-10-29T13:17:13.558163+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico"
> host=shrouded-bastion-04661.herokuapp.com
> request_id=c6b25451-528e-4bed-a415-f35b0bcb739f fwd="71.231.14.146"
> dyno= connect= service= status=503 bytes= protocol=https

我不确定该怎么做,但是当我在本地运行应用程序时,它说:

2021-10-29T13:15:49.232426+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-29T13:15:54.128556+00:00 heroku[web.1]: Starting process with command `python manage.py runserver 0.0.0.0:5000`
2021-10-29T13:15:55.975995+00:00 app[web.1]: Watching for file changes with StatReloader
2021-10-29T13:15:55.976241+00:00 app[web.1]: Performing system checks...
2021-10-29T13:15:55.976241+00:00 app[web.1]:
2021-10-29T13:15:56.168039+00:00 app[web.1]: System check identified no issues (0 silenced).
2021-10-29T13:15:56.434599+00:00 app[web.1]:
2021-10-29T13:15:56.434616+00:00 app[web.1]: You have 20 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, boutique, contenttypes, sessions.
2021-10-29T13:15:56.434619+00:00 app[web.1]: Run 'python manage.py migrate' to apply them.
2021-10-29T13:15:56.434663+00:00 app[web.1]: October 29, 2021 - 06:15:56
2021-10-29T13:15:56.434711+00:00 app[web.1]: Django version 3.2.8, using settings 'store.settings'
2021-10-29T13:15:56.434711+00:00 app[web.1]: Starting development server at http://0.0.0.0:5000/
2021-10-29T13:15:56.434711+00:00 app[web.1]: Quit the server with CONTROL-C.

它说我有 20 个未应用的迁移,这就是它不能在线工作的原因吗?在进行迁移然后迁移时,它只是说没有要应用的迁移。

大多数人似乎建议对 Procfile 进行一些更改,但我不太了解 Procfile,也不知道要写什么或为什么要写它。无论如何,我没有找到任何似乎适用于我的应用程序的东西,其中大部分似乎与 JSON 有关。

【问题讨论】:

  • 推送您的迁移,然后尝试。您需要在本地文件夹中推送迁移
  • 我运行了“heroku run python manage.py migrate”并且它迁移了。我仍然崩溃,但同样的错误。

标签: python django heroku web-hosting


【解决方案1】:

首先确保您在项目设置中设置了正确的数据库设置,

大多数人似乎建议对 Procfile 进行一些更改,但我不明白 Procfiles

他们可能建议您将此行添加到您的 Procfile 中

release: python manage.py migrate

有关 Procfile 的更多信息,请查看this

这个问题似乎也很相似,从你分享的信息中不太明白你的项目流程是什么,但也许对question有帮助

【讨论】:

  • Procfiles 上的 Heroku 文档在我看来非常糟糕。他们没有解释什么意思或什么时候使用它,当我看着它时,我觉得我在读中文。感谢您提供指向另一个问题的链接!那家伙似乎在使用一种叫做 daphne 的东西,它在他的 Procfile 中,但我没有使用它。一个有趣的问题是他似乎对 $PORT 有问题,我也是。你知道它是什么或如何访问它吗?
猜你喜欢
  • 2018-06-27
  • 2016-11-05
  • 2020-06-03
  • 2014-06-14
  • 2018-07-02
  • 2021-01-26
  • 2015-10-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多