Heroku 不识别迁移

Heroku not recognizing migrations

我终于让我的 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 进行一些更改,但我不太了解 Procfiles,也不知道要写什么或为什么要写它。无论如何,我没有找到任何似乎适用于我的应用程序的东西,其中大部分似乎是关于 JSON.

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

Most people seem to suggest some change to the Procfile but I don't understand Procfiles

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

release: python manage.py migrate

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

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