首页 > 解决方案 > 为什么 gunicorn 从不同的目录运行模块?

问题描述

Gunicorn 20.0.4 从不同的目录运行应用程序。文件夹结构:

folder0/
  app.py
folder1/
  app.py

在这两个app.py文件中都有一个 Flaskapp实例。在folder0中,我跑

$ gunicorn app:app

当我导航到http://localhost:8000时,我看到应用程序folder1正在运行。

为什么会发生这种情况,我该如何解决?

2020 年 7 月 11 日更新

该应用程序folder0按预期运行:

$ python3 app.py

当我重命名folder1并运行gunicorn app:appfolder0,它找不到我的模块。

2020 年 7 月 12 日更新

我在这里打开了一个关于此的 github 问题:https ://github.com/benoitc/gunicorn/issues/2378

标签: flaskgunicorn

解决方案


推荐阅读