我正在尝试使用Heroku启动一个简单的投资组合网站,但每次运行该应用程序时,都会出现H10错误。我该怎么解决?
我在整个过程中遇到了各种错误,并设法解决了。但是这个最近的错误,H10,我似乎无法弄清楚是怎么回事。在日志中,我可以看到应用程序在哪里询问我对17个文件进行迁移。我运行python manage.py migration
,它说没有任何更新。然后,我尝试进行heroku run python manage.py
迁移,它成功运行。
然后,我执行git add .
,git commit -m "comment"
,最后执行git push heroku master
。这会在运行时发生。
Enumerating objects: 35, done.
Counting objects: 100% (35/35), done.
Delta compression using up to 8 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 3.76 KiB | 961.00 KiB/s, done.
Total 26 (delta 16), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.7.3
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Found python-3.6.8, removing
remote: -----> Installing python-3.7.4
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pure-forest-76170.
remote:
我运行git logs
来了解实际情况,我明白了:
$ heroku logs
2019-08-07T00:09:33.110434+00:00 app[web.1]: ModuleNotFoundError: No module named 'django'
2019-08-07T00:09:33.110440+00:00 app[web.1]:
2019-08-07T00:09:33.110442+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2019-08-07T00:09:33.110444+00:00 app[web.1]:
2019-08-07T00:09:33.110446+00:00 app[web.1]: Traceback (most recent call last):
2019-08-07T00:09:33.110451+00:00 app[web.1]: File "manage.py", line 21, in <module>
2019-08-07T00:09:33.110579+00:00 app[web.1]: main()
2019-08-07T00:09:33.110582+00:00 app[web.1]: File "manage.py", line 16, in main
2019-08-07T00:09:33.110688+00:00 app[web.1]: ) from exc
2019-08-07T00:09:33.110702+00:00 app[web.1]: ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
2019-08-07T00:09:33.173919+00:00 heroku[web.1]: Process exited with status 1
2019-08-07T00:14:35.000000+00:00 app[api]: Build started by user dougcueva@gmail.com
2019-08-07T00:15:09.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/431a0419-2366-49cf-a789-6ba99c97c2e9/activity/builds/2c7559e8-722c-4695-9aa3-9825fea9a936
2019-08-07T00:24:03.000000+00:00 app[api]: Build started by user dougcueva@gmail.com
2019-08-07T00:25:17.475129+00:00 heroku[web.1]: State changed from crashed to starting
2019-08-07T00:25:17.208825+00:00 app[api]: Release v11 created by user dougcueva@gmail.com
2019-08-07T00:25:17.208825+00:00 app[api]: Deploy 04ad6c5b by user dougcueva@gmail.com
2019-08-07T00:25:30.290292+00:00 heroku[web.1]: Starting process with command `python manage.py runserver`
2019-08-07T00:25:34.075613+00:00 app[web.1]: Watching for file changes with StatReloader
2019-08-07T00:25:34.076126+00:00 app[web.1]: Performing system checks...
2019-08-07T00:25:34.076129+00:00 app[web.1]:
2019-08-07T00:25:34.216676+00:00 app[web.1]: System check identified no issues (0 silenced).
2019-08-07T00:25:34.332304+00:00 app[web.1]:
2019-08-07T00:25:34.332333+00:00 app[web.1]: You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
2019-08-07T00:25:34.333086+00:00 app[web.1]: Run 'python manage.py migrate' to apply them.
2019-08-07T00:25:34.333834+00:00 app[web.1]: August 07, 2019 - 00:25:34
2019-08-07T00:25:34.334253+00:00 app[web.1]: Django version 2.2.4, using settings 'mypage.settings'
2019-08-07T00:25:34.334256+00:00 app[web.1]: Starting development server at http://127.0.0.1:8000/
2019-08-07T00:25:34.334258+00:00 app[web.1]: Quit the server with CONTROL-C.
2019-08-07T00:25:43.000000+00:00 app[api]: Build succeeded
2019-08-07T00:26:30.943890+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-07T00:26:30.975682+00:00 heroku[web.1]: State changed from crashed to starting
2019-08-07T00:26:30.803796+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-08-07T00:26:30.803900+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-08-07T00:26:30.920622+00:00 heroku[web.1]: Process exited with status 137
2019-08-07T00:26:42.626239+00:00 heroku[web.1]: Starting process with command `python manage.py runserver`
2019-08-07T00:26:45.714281+00:00 app[web.1]: Watching for file changes with StatReloader
2019-08-07T00:26:45.714713+00:00 app[web.1]: Performing system checks...
2019-08-07T00:26:45.714716+00:00 app[web.1]:
2019-08-07T00:26:45.819598+00:00 app[web.1]: System check identified no issues (0 silenced).
2019-08-07T00:26:45.901479+00:00 app[web.1]:
2019-08-07T00:26:45.901498+00:00 app[web.1]: You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
2019-08-07T00:26:45.901687+00:00 app[web.1]: Run 'python manage.py migrate' to apply them.
2019-08-07T00:26:45.901888+00:00 app[web.1]: August 07, 2019 - 00:26:45
2019-08-07T00:26:45.902095+00:00 app[web.1]: Django version 2.2.4, using settings 'mypage.settings'
2019-08-07T00:26:45.902098+00:00 app[web.1]: Starting development server at http://127.0.0.1:8000/
2019-08-07T00:26:45.902100+00:00 app[web.1]: Quit the server with CONTROL-C.
2019-08-07T00:27:42.832698+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-07T00:27:42.733759+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-08-07T00:27:42.733860+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-08-07T00:27:42.810488+00:00 heroku[web.1]: Process exited with status 137
2019-08-07T00:29:09.519204+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-forest-76170.herokuapp.com request_id=6dae5113-685e-45e1-a986-2de67baef8f3 fwd="65.24.114.189" dyno= connect= service= status=503 bytes= protocol=https
2019-08-07T00:41:36.000000+00:00 app[api]: Build started by user dougcueva@gmail.com
2019-08-07T00:42:04.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/431a0419-2366-49cf-a789-6ba99c97c2e9/activity/builds/5bf4d2a5-ff6a-49ce-afb3-2ee2033a4e33
2019-08-07T00:43:51.681018+00:00 app[api]: Starting process with command `python manage.py migrate` by user dougcueva@gmail.com
2019-08-07T00:44:03.156138+00:00 heroku[run.9227]: Awaiting client
2019-08-07T00:44:03.186164+00:00 heroku[run.9227]: Starting process with command `python manage.py migrate`
2019-08-07T00:44:03.404423+00:00 heroku[run.9227]: State changed from starting to up
2019-08-07T00:44:08.428935+00:00 heroku[run.9227]: State changed from up to complete
2019-08-07T00:44:08.407118+00:00 heroku[run.9227]: Process exited with status 0
2019-08-07T00:44:30.000000+00:00 app[api]: Build started by user dougcueva@gmail.com
2019-08-07T00:44:53.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/431a0419-2366-49cf-a789-6ba99c97c2e9/activity/builds/ca4302c0-1be4-404d-ad5d-2fea02651b7f
2019-08-07T00:46:31.000000+00:00 app[api]: Build started by user dougcueva@gmail.com
2019-08-07T00:46:59.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/431a0419-2366-49cf-a789-6ba99c97c2e9/activity/builds/23b45acc-4468-4235-975f-515035ef9afc
2019-08-07T00:50:07.000000+00:00 app[api]: Build started by user dougcueva@gmail.com
2019-08-07T00:50:33.000000+00:00 app[api]: Build failed -- check your build output: https://dashboard.heroku.com/apps/431a0419-2366-49cf-a789-6ba99c97c2e9/activity/builds/91e649b1-58bc-4d07-a003-9642e2847102
2019-08-07T00:52:13.995117+00:00 heroku[web.1]: State changed from crashed to starting
2019-08-07T00:52:29.273845+00:00 heroku[web.1]: Starting process with command `python manage.py runserver`
2019-08-07T00:52:33.031975+00:00 app[web.1]: Watching for file changes with StatReloader
2019-08-07T00:52:33.032434+00:00 app[web.1]: Performing system checks...
2019-08-07T00:52:33.032437+00:00 app[web.1]:
2019-08-07T00:52:33.295804+00:00 app[web.1]: System check identified no issues (0 silenced).
2019-08-07T00:52:33.403292+00:00 app[web.1]: August 07, 2019 - 00:52:33
2019-08-07T00:52:33.403361+00:00 app[web.1]: Django version 2.2.4, using settings 'mypage.settings'
2019-08-07T00:52:33.403364+00:00 app[web.1]: Starting development server at http://127.0.0.1:8000/
2019-08-07T00:52:33.403366+00:00 app[web.1]: Quit the server with CONTROL-C.
2019-08-07T00:52:31.000000+00:00 app[api]: Build started by user dougcueva@gmail.com...
我希望输出成功,并允许我运行heroku open
并看到我的网站弹出。