【问题标题】:error deploying django 2.0 to heroku将 django 2.0 部署到 heroku 时出错
【发布时间】:2018-06-05 15:26:31
【问题描述】:

我创建了我的第一个 Django 2.0 项目并尝试将其部署到 Heroku

我已经设置好了,所有的推拉都很顺利。

但是当我使用

访问我的应用程序端点时
https://jotitdown.herokuapp.com

它没有加载,heroku logs 给出了这个错误

2017-12-23T07:04:45.333450+00:00 heroku[router]: 
at=error code=H10 desc="App crashed" method=GET path="/" 
host=jotitdown.herokuapp.com request_id=cd2a9bb6-fae8-4317-af39-b271c1d74af5 
fwd="45.115.107.34" dyno= connect= service= status=503 bytes= protocol=https

我在settings.py中设置了这个,这里`

DEBUG = True

ALLOWED_HOSTS = ['*', 'jotitdown.herokuapp.com', '*.herokuapp.com']

Profile

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

我尝试在本地运行

heroku local web

它给出了错误

[WARN] No ENV file found
web.1   |  /bin/sh: gunicorn: command not found
web.1   Exited with exit code 127

【问题讨论】:

    标签: django heroku django-2.0


    【解决方案1】:

    Gunicorn 不是 Heroku 自动提供的。您的本地副本显然缺少它,我怀疑 Heroku 上也缺少它。

    将其添加到您的requirements.txt 并在本地安装,然后再次使用heroku local 进行测试。假设可行,将更改提交到 requirements.txt 并再次推送到 Heroku。

    【讨论】:

      【解决方案2】:

      通过删除所有已安装的包并使用 Pipenv 重新安装它们来解决。

      要启动 Heroku 本地网络,如果您使用的是pipenv 的虚拟环境,则需要运行以下命令。

      pipenv run heroku local web
      

      这个答案可能对使用pipenv的人有所帮助。

      【讨论】:

        猜你喜欢
        • 2021-12-14
        • 2019-06-25
        • 2018-12-25
        • 2021-05-16
        • 2020-08-04
        • 2013-04-14
        • 1970-01-01
        • 2017-11-25
        相关资源
        最近更新 更多