【问题标题】:Procfile gunicorn doesn't find module (Django)Procfile gunicorn 找不到模块(Django)
【发布时间】:2021-08-20 12:58:59
【问题描述】:

我的项目结构是这样的

git_root/
-django_project_root/
--core/
---...
---settings.py
---wsgi.py
---...
--app1/
--...
Procfile
...

所以我在 git_root 中有 Procfile,在 django_project/core/ 中有 wsgi 我的 Procfile 看起来像这样

web: gunicorn --preload django_project.core.wsgi

Heroku 日志:

ModuleNotFoundError: No module named 'core'

附:还尝试了接下来的 2 件事

  1. 尝试将 Procfile 放入 django_project 文件夹。但是部署的时候没有找到。
  2. 创建了新的 repo 并解开了 django_project,所以 git_root 现在是 django_project。并将 Procfile 编辑为如下所示
web: gunicorn --preload core.wsgi

这很奏效。但我需要它来处理初始回购。

【问题讨论】:

    标签: django heroku gunicorn modulenotfounderror


    【解决方案1】:

    Nvm,我刚刚做了

    web: cd django_project && gunicorn --preload django_project.core.wsgi
    

    到我的 Procfile 并且效果很好

    【讨论】:

      猜你喜欢
      • 2021-07-24
      • 1970-01-01
      • 1970-01-01
      • 2012-05-27
      • 1970-01-01
      • 2019-11-09
      • 2016-12-15
      • 2013-09-18
      • 1970-01-01
      相关资源
      最近更新 更多