带有heroku的django项目:应用程序错误
django project with heroku: application error
我成功将项目部署到 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
我的过程文件
"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()
并且可以使用 heroku ps:scale web=1 修复与 H14 相关的文档错误,然后弹出
Scaling dynos... !
! Couldn't find that process type.
当我查看我的 Heroku 帐户时,资源中的 Dynos 显示以下 tex,尽管我已成功添加我的 Procfile。
This app has no process types yet
Add a Procfile to your app in order to define its process types. Learn more
我该如何解决这个问题?
谢谢你的帮助。
上次遇到这个问题是因为找不到需求。从本地更新您的 requirements.txt 文件。
另外你想做的是在你的 settings.py
DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = True
为生产添加这些生产线。这会将错误传播到日志中。在那里你可以看到为什么你会收到应用程序错误。
(我敢打赌它丢失了一些包裹。让我知道它是什么。)
您的应用没有任何进程运行。
您需要使用 heroku ps:scale web=1
命令缩放您的 web
dyno。
当然,这假设您已经在 Procfile 中配置了 web
进程类型。
今天我遇到了同样的错误。在我的根目录中,我有没有任何扩展名的 Procfile,但是当我在 visual studio 代码中打开代码时,Procfile 的扩展名为 .txt 并且显示为“Procfile.txt”。我刚刚从文件中删除了 .txt 并保存了它。这解决了我的错误。
你可以参考我的post了解更多:
Getting application error while running the python app on heroku
我成功将项目部署到 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
我的过程文件
"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()
并且可以使用 heroku ps:scale web=1 修复与 H14 相关的文档错误,然后弹出
Scaling dynos... !
! Couldn't find that process type.
当我查看我的 Heroku 帐户时,资源中的 Dynos 显示以下 tex,尽管我已成功添加我的 Procfile。
This app has no process types yet
Add a Procfile to your app in order to define its process types. Learn more
我该如何解决这个问题? 谢谢你的帮助。
上次遇到这个问题是因为找不到需求。从本地更新您的 requirements.txt 文件。
另外你想做的是在你的 settings.py
DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = True
为生产添加这些生产线。这会将错误传播到日志中。在那里你可以看到为什么你会收到应用程序错误。
(我敢打赌它丢失了一些包裹。让我知道它是什么。)
您的应用没有任何进程运行。
您需要使用 heroku ps:scale web=1
命令缩放您的 web
dyno。
当然,这假设您已经在 Procfile 中配置了 web
进程类型。
今天我遇到了同样的错误。在我的根目录中,我有没有任何扩展名的 Procfile,但是当我在 visual studio 代码中打开代码时,Procfile 的扩展名为 .txt 并且显示为“Procfile.txt”。我刚刚从文件中删除了 .txt 并保存了它。这解决了我的错误。
你可以参考我的post了解更多:
Getting application error while running the python app on heroku