带有heroku的django项目:应用程序错误

时间:2018-07-05 12:52:22

标签: django heroku web-deployment

我成功地将项目部署到了​​Heroku。但是当我运行Heroku打开时会引发应用程序错误 应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以获取详细信息。

我的日志在这里

(dj12) λ heroku logs
2018-07-05T07:06:17.443987+00:00 app[api]: Initial release by user     ermiaskidanegebre@gmail.com
2018-07-05T07:06:17.443987+00:00 app[api]: Release v1 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:06:17.909289+00:00 app[api]: Release v2 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:06:17.909289+00:00 app[api]: Enable Logplex by user ermiaskidanegebre@gmail.com
2018-07-05T07:16:35.051508+00:00 app[api]: Attach DATABASE (@ref:postgresql-shaped-50056) by user ermiaskidanegebre@gmail.com
2018-07-05T07:16:35.051508+00:00 app[api]: Release v3 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:24:48.143580+00:00 app[api]: Set SECRET_KEY config vars by user ermiaskidanegebre@gmail.com
2018-07-05T07:24:48.143580+00:00 app[api]: Release v4 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:33:04.050618+00:00 app[api]: Set SECRET_KEY config vars by user ermiaskidanegebre@gmail.com
2018-07-05T07:33:04.050618+00:00 app[api]: Release v5 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:40:34.881810+00:00 app[api]: Set EMAIL_PASSWORD config vars by user ermiaskidanegebre@gmail.com
2018-07-05T07:40:34.881810+00:00 app[api]: Release v6 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:49:13.302208+00:00 app[api]: Release v7 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:49:13.302208+00:00 app[api]: Set DISABLE_COLLECTSTATIC config vars by user ermiaskidanegebre@gmail.com
2018-07-05T07:54:43.000000+00:00 app[api]: Build started by user ermiaskidanegebre@gmail.com
2018-07-05T07:55:09.406852+00:00 app[api]: Release v8 created by user ermiaskidanegebre@gmail.com
2018-07-05T07:55:09.406852+00:00 app[api]: Deploy 2fdb68de by user ermiaskidanegebre@gmail.com
2018-07-05T07:55:18.000000+00:00 app[api]: Build succeeded
2018-07-05T07:57:14.239360+00:00 app[api]: Starting process with command `python manage.py migrate` by user ermiaskidanegebre@gmail.com
2018-07-05T07:57:20.853528+00:00 heroku[run.2986]: State changed from starting to up
2018-07-05T07:57:20.965558+00:00 heroku[run.2986]: Awaiting client
2018-07-05T07:57:21.013142+00:00 heroku[run.2986]: Starting process with command `python manage.py migrate`
2018-07-05T07:57:26.012552+00:00 heroku[run.2986]: Process exited with status 1
2018-07-05T07:57:26.032134+00:00 heroku[run.2986]: State changed from up to complete
2018-07-05T08:01:58.000000+00:00 app[api]: Build started by user ermiaskidanegebre@gmail.com
2018-07-05T08:02:15.941485+00:00 app[api]: Release v9 created by user ermiaskidanegebre@gmail.com
2018-07-05T08:02:15.941485+00:00 app[api]: Deploy 8a0e03de by user ermiaskidanegebre@gmail.com
2018-07-05T08:02:25.000000+00:00 app[api]: Build succeeded
2018-07-05T08:03:43.462294+00:00 heroku[run.1120]: Awaiting client
2018-07-05T08:03:43.510884+00:00 heroku[run.1120]: Starting process with command `python manage.py migrate`
2018-07-05T08:03:43.859691+00:00 heroku[run.1120]: State changed from starting to up
 2018-07-05T08:03:37.888541+00:00 app[api]: Starting process with command `python manage.py migrate` by user ermiaskidanegebre@gmail.com
2018-07-05T08:03:53.506152+00:00 heroku[run.1120]: Process exited with status 0
2018-07-05T08:03:53.525335+00:00 heroku[run.1120]: State changed from up to complete
2018-07-05T08:13:52.212453+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=750bffb9-e6bb-4ea7-94bd-09772529bf3c fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T08:13:52.636447+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=django-ecommerce-2.herokuapp.com request_id=be57a379-0d82-4251-9218-049d3cdfb9a6 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T08:57:48.239032+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=e5708b4e-1ef6-4167-a70a-0a99c9b8aecf fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
 2018-07-05T08:57:48.702316+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=django-ecommerce-2.herokuapp.com request_id=d92730e4-c5e9-4570-a709-311a07e0e3dc fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T09:11:36.000000+00:00 app[api]: Build started by user ermiaskidanegebre@gmail.com
2018-07-05T09:11:53.696459+00:00 app[api]: Deploy 2993315c by user ermiaskidanegebre@gmail.com
 2018-07-05T09:11:53.696459+00:00 app[api]: Release v10 created by user ermiaskidanegebre@gmail.com
2018-07-05T09:12:03.000000+00:00 app[api]: Build succeeded
2018-07-05T09:32:26.285646+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=08b476e4-c7f9-43b4-b706-9d44d3b8c8c1 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T09:32:55.648599+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=5e4b151f-757b-49ad-8138-c47877c2c3e1 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:09:37.172582+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=ea6c2402-cfe2-4cb5-a910-2b6d152174f4 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:10:05.085667+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=f91cef75-167c-4160-8709-e73736384dbc fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:10:06.448716+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=5fa29e24-e3d1-439f-bf88-dd1f266ac85a fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
 2018-07-05T11:22:38.501221+00:00 app[api]: Starting process with command `bash` by user ermiaskidanegebre@gmail.com
 2018-07-05T11:22:43.651327+00:00 heroku[run.8345]: Awaiting client
 2018-07-05T11:22:43.684186+00:00 heroku[run.8345]: Starting process with command `bash`
 2018-07-05T11:22:43.729572+00:00 heroku[run.8345]: State changed from starting to up
 2018-07-05T11:29:31.865357+00:00 heroku[run.8345]: Process exited with status 127
 2018-07-05T11:29:32.006562+00:00 heroku[run.8345]: State changed from up to     complete

我的procfile

"web: gunicorn ecommerce2.wsgi" 

我的wsgi.py

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ecommerce2.settings")

application = get_wsgi_application()

和与H14有关的文档错误可以通过 heroku ps:scale web = 1 修复,然后弹出

Scaling dynos... !
!    Couldn't find that process type.

即使我成功添加了Procfile,当我查看Heroku帐户时,资源中的Dynos仍在说以下tex。

This app has no process types yet 
Add a Procfile to your app in order to define its process types. Learn more

如何解决此问题? 谢谢你的帮助。

3 个答案:

答案 0 :(得分:0)

上次出现此问题与找不到要求有关。从本地更新您的requirements.txt文件。

您还想在settings.py

DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = True

添加这些生产线。这将错误记录。在那里,您可以看到为什么出现应用程序错误。

(我愿意打赌它缺少一些包裹。让我知道它是什么。)

答案 1 :(得分:0)

今天,我遇到了同样的错误。在我的根目录中,我具有没有任何扩展名的Procfile,但是当我在Visual Studio代码中打开代码时,Procfile的扩展名为.txt,并显示为“ Procfile.txt”。我只是从文件中删除了.txt并保存了它。这解决了我的错误。

您可以参考我的帖子进行更多说明:

Getting application error while running the python app on heroku

答案 2 :(得分:-1)

您的应用没有任何进程正在运行。

您需要使用web命令缩放heroku ps:scale web=1测功机。

当然,这假设您在Procfile中配置了web进程类型。