微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

带有heroku的应用程序错误django博客应用程序

如何解决带有heroku的应用程序错误django博客应用程序

我向 Heroku 部署了一个 Django 博客应用,构建成功,但在打开应用时,我看到一个页面说应用程序错误,它说要检查日志,但我没有收到消息。

这是日志

2021-04-27T15:41:49.301926+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=campusstory.herokuapp.com request_id=c5396159-b7e0-4ada-8764-54d40add0bc2 fwd="102.89.3.201" dyno= connect= service= status=503 bytes= protocol=https
2021-04-27T15:41:49.674072+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=campusstory.herokuapp.com request_id=22a9b86c-9b7a-4851-8ff1-7c0c8c733a44 fwd="102.89.2.205" dyno= connect= service= status=503 bytes= protocol=https
2021-04-27T15:47:31.201263+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=campusstory.herokuapp.com request_id=477c9fb1-4b53-4bb8-9fc2-1f4e66604ff0 fwd="102.89.2.205" dyno= connect= service= status=503 bytes= protocol=https
2021-04-27T15:47:31.619852+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=campusstory.herokuapp.com request_id=3ef7ae48-18cb-4979-8bce-ef80dc4e021f fwd="102.89.3.44" dyno= connect= service= status=503 bytes= protocol=https
2021-04-27T15:47:33.950102+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=campusstory.herokuapp.com request_id=4abaafe0-8bd6-4d0c-a7fb-c0524fc4ca00 fwd="102.89.3.201" dyno= connect= service= status=503 bytes= protocol=https
2021-04-27T15:47:34.389228+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=campusstory.herokuapp.com request_id=3b3953cf-8f47-4de9-ba88-4da2c4e14249 fwd="102.89.2.205" dyno= connect= service= status=503 bytes= protocol=https

解决方法

一个常见的错误是没有正确设置您的 Procfile。您可以阅读有关它的更多信息 here。为了举例,这里是你的 Procfile 应该是什么样子

web: gunicorn myproject.wsgi --log-file -

当然,请确保您的 Django 项目中安装了 gunicorn。

现在,如果这已经在您的项目中,问题可能是您没有运行任何 dynnos。可以通过以下方式让 Heroku 知道来修复:

$ heroku ps:scale web=1

在这里您可以了解dyno configurationsdeploying您的应用

,

我是 Django 的相对新手,最近我第一次经历了部署到 Heroku 的过程,我觉得这并不简单。以下是您需要做的一些事情才能使其发挥作用:

安装(在您的虚拟环境中)软件包 psycopg2django-herokugunicorn

通过运行 requirements.txt 在本地项目文件夹的顶层创建一个 pip freeze > requirements.txt

正如在另一个答案中指出的那样,在包含行 Procfile

的项目目录中创建一个 web: gunicorn myproject.wsgi --log-file -

在您的 settings.py 文件中,添加 import django_heroku 和(在底部可以)django_heroku.settings(locals())

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?