部署在heroku上的Django网站不起作用



我创建了一个django网站,并试图将其部署到heroku。我遵循了这个教程,做了他所做的一切,但我在日志中得到了这些错误

2020-07-10T02:06:01.015381+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=website.herokuapp.com request_id=9efff235-77f8-41e8-bc9e-9f80bd2b6aa1 fwd="172.98.86.231" dyno= connect= service= status=503 bytes= protocol=https
2020-07-10T02:06:01.743381+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=website.herokuapp.com request_id=bf2f44a0-8f5c-4e63-a1c9-e16a33761803 fwd="172.98.86.231" dyno= connect= service= status=503 bytes= protocol=https

我的procfile有这些内容

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

我的requirements.txt包括这些

asgiref==3.2.3
Django==2.1.7
pytz==2019.3
sqlparse==0.3.0
SQLAlchemy==1.3.9
psycopg2==2.8.4
Jinja2==2.10.3
gunicorn==20.0.4

我过去在本地运行该网站时也会遇到同样的HTTP错误,但该网站过去可以正常渲染和工作。我在heroku中得到了同样的错误,但网站不工作

有人能解释这些错误的含义以及如何修复它们吗?或者你也可以回复一个视频或文档的链接,你用来部署你的网站并使用

我想明白了。在我的情况下,我将";procfile";至";Procfile";将procfile的内容更新为

web: gunicorn website.wsgi:application --log-file -
python manage.py collectstatic --noinput
manage.py migrate

这起到了的作用

您正面临这个问题,因为Gunicorn没有运行。

请尝试在本地计算机上运行以下命令:";gunicorn网站.wsgi—日志文件-"它运行吗?

Heroku是否存在任何构建错误?

我也遇到了同样的问题,问题很简单:我忘记把gunicorn放在requirements.txt上,所以heroku服务器没有安装所需的包。我将gunicorn添加到requirements.txt,再次推送,它对我有效!

最新更新