在Heroku上找不到gunicorn

5

我希望在Heroku上部署一个非常基础的Django应用程序。我按照说明操作,但浏览器仍然显示Heroku错误页面,Heroku日志显示:

bash: gunicorn: command not found

我在我的 requirements.txt 中加入了 gunicorn,按照文档的指示配置了 wsgi.py 和 Procfile。还有什么可以尝试的吗?
编辑:我也试着在 Heroku 上手动安装 gunicorn(heroku run pip install gunicorn),这个过程很顺利,所以我很确定已经安装了 gunicorn。为什么 Heroku 找不到它呢?
编辑2:看起来我可以手动安装 gunicorn(heroku run bash 然后 pip install gunicorn):
~ $ gunicorn
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: No application module specified.

但是当我注销并重新登录到Bash时,会出现以下情况:
~ $ gunicorn
bash: gunicorn: command not found

Heroku似乎安装了gunicorn,但随后又将其丢弃。这是怎么回事?

请问您能否发布您的 Procfile 和 project.wsgi 文件? - Erik
1个回答

2

你好,遇到了同样的问题,这可能会有所帮助:

前往以下网址:

https://github.com/heroku/heroku-buildpack-python

并尝试在项目根目录终端中运行此命令:

heroku buildpacks:set git://github.com/heroku/heroku-buildpack-python.git

然后使用以下命令更新Heroku:

git push heroku master

1
该命令可以是 heroku buildpacks:set heroku/python。这对我很有效,因为我已经有了一个 Python 应用程序,所以我没有克隆 Heroku 的 Python 应用程序模板。谢谢。 - Leonardo Brambilla

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接