【问题标题】:heroku procfile problem : ModuleNotFoundError: No module named 'myApp.wsgi'heroku procfile 问题:ModuleNotFoundError: No module named 'myApp.wsgi'
【发布时间】:2021-06-05 12:43:53
【问题描述】:

我正在 Heroku 上部署我的第一个 django 应用程序。部署 heroku 后不会启动我的应用程序。检查heroku后logs --tail 我有一个错误:

: ModuleNotFoundError: No module named 'tabele.wsgi'

我的 procfile 看起来像:

web: gunicorn tabele.wsgi:application --log-file -

我也试试:

web: gunicorn tabele:app

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

我是初学者,我不明白(在我的情况下是“tabele”)是否应该是包含 manage.py 的文件夹或不同的文件夹? 在我的项目文件夹中,包括manage.py 和另一个包括settings.py 和wsgi.py 的文件夹具有相同的名称“tabele” 您能否解释一下 procfile 文件中的内容以便更好地理解?

知道我做错了什么吗?

【问题讨论】:

    标签: django heroku procfile


    【解决方案1】:
    djangoherokuapp
      |-- tabele/
        |     |---  __init_-.py
        |     |---  settings.py
        |     |---  urls.py
        |     |---  wsgi.py
        |----- manage.py
        |------Procfile  ⬅⬅⬅
        |------requirements.txt
        |----- app/
        |     |---  admin.py
        |     |---  apps.py
        |     |---  __init__.py
        |     |---  models.py
        |     |---  tests.py
        |     |---  views.py
    • 在项目根目录下添加Procfile,定义流程类型 并明确声明应该执行什么命令来启动你的 应用。

    • 打开 Procfile 并添加以下行:

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

    • --log-file - 表示“记录到标准输出”。 --log-file 标志让你 设置日志文件的路径,- 表示“stdout”(在此上下文中)。

    或尝试:

     web: gunicorn tabele.wsgi
    

    【讨论】:

    • 感谢您的帮助。现在它起作用了。我之前把 procfile 放到了错误的目录中。
    猜你喜欢
    • 2020-09-12
    • 2020-12-29
    • 2020-08-08
    • 2020-09-26
    • 1970-01-01
    • 2022-12-27
    • 2022-12-27
    • 2022-12-19
    相关资源
    最近更新 更多