【发布时间】:2017-09-16 04:21:48
【问题描述】:
我收到以下错误
"ModuleNotFoundError: No module named 'class1'"
结构
- hello-world
- src
- __init__
- main
- class1
- Procfile
main1 文件如下所示:
from class1 import G
APP = Flask(__name__)
@APP.route('/', methods=['GET'])
def index() -> str:
return 'We are alive'
简介:
web: gunicorn src.main:app --log-file -
heroku 日志向我们显示以下错误:
ModuleNotFoundError: 没有名为“class1”的模块
我不知道我做错了什么。我正在使用pipenv安装依赖项,它包含gunicorn。
【问题讨论】:
-
你的 PYTHONPATH 好像是
hello-world,所以应该是from src.class1 import G。 -
你需要把你的procfile改成
web: gunicorn src.main:APP --log-file -