【问题标题】:Heroku error H10 when deploying Django app部署 Django 应用程序时出现 Heroku 错误 H10
【发布时间】:2021-12-06 02:05:50
【问题描述】:

我的问题是,当我尝试在 heroku 上部署 Django 应用程序时,我收到 H10 错误,并且显然无法访问该站点。 heroku logs --tail 不显示除 H10 错误代码之外的任何特定内容

at=error code=H10 desc="App 崩溃" method=GET

我的 Procfile 正在加载 web 进程,所以我猜它在正确的位置,但我相信该 web 进程的配置可能是错误的。我遇到了导致 H14 错误的问题,因为我的 Procfile 位于错误的目录中。它是 manage.py 文件所在的项目目录。我不得不将它移到上面的一个目录,因为它是我的存储库的根文件(.git 文件就在那里)。这是我的 Procfile:

web: gunicorn api_project.wsgi

我的目录树是这样的:

ROOT/
├─ .git/
├─ Procfile
├─ api_project/
│  ├─ api_project/
│  ├─ manage.py
│  ├─ robots.txt
├─ .gitignore

wsgi 文件位于发送 api_project 目录中。也许 Procfile 中的路径应该不同?

【问题讨论】:

    标签: python django heroku procfile


    【解决方案1】:

    如果将来有人会遇到和我一样的问题,那么原因是 Procfile 中的目录配置错误。您必须在您的网络进程中添加一些内容:

    web: gunicorn --pythonpath <name of dir that contains your project folder> <actual dir that contains wsgi file>.wsgi
    

    在我的情况下是:

    web: gunicorn --pythonpath api_project api_project.wsgi
    

    【讨论】:

      猜你喜欢
      • 2021-11-27
      • 1970-01-01
      • 2020-10-21
      • 1970-01-01
      • 2020-09-24
      • 2019-06-12
      • 1970-01-01
      • 1970-01-01
      • 2018-06-28
      相关资源
      最近更新 更多