我成功安装了gunicorn:
remote: -----> Removing .DS_Store files
remote: -----> Python app detected
remote: -----> Installing dependencies with pip
remote: Collecting gunicorn==19.0.0 (from -r requirements.txt (line 1))
remote: Downloading gunicorn-19.0.0.tar.gz (382kB)
remote: Installing collected packages: gunicorn
remote: Running setup.py install for gunicorn
remote: Successfully installed gunicorn-19.0.0
我的Procfile:
web: gunicorn myapp:app --log-file=-
但部署时应用程序崩溃了:
bash: gunicorn: command not found
我尝试添加heroku python buildpack,但没有运气。如果我回滚到之前的提交(其中requirements.txt
和Procile
都未更改),它可以正常工作:
heroku/web.1: Starting process with command `gunicorn myapp:app --log-file=-`
app/web.1: 2015-10-08 17:04:18 [3] [INFO] Listening at: http://0.0.0.0:51854 (3)
答案 0 :(得分:54)
确保decrypt
gunicorn
答案 1 :(得分:10)
在远程卸载所有要求并重新安装后,问题似乎已得到解决。
答案 2 :(得分:2)
如果您在项目根目录中同时具有Requirements.txt和Pipfile,那么我建议删除Pipfile,并将所有需求列在Requirements.txt文件中(包括gunicorn)。
然后它将显示:“从pip安装需求”,并且将安装requirements.txt中列出的所有需求。
答案 3 :(得分:2)
检查gunicorn
中是否有requirements.txt
后,运行:
pip install -r requirements.txt
我的输出包含几个Requirement already satisfied: ...
,但尚未安装gunicorn
:
Collecting gunicorn (from -r requirements.txt (line 2))
Using cached ...
Installing collected packages: gunicorn
Successfully installed gunicorn-19.9.0
答案 4 :(得分:2)
Heroku的Python文档似乎已经过时了……显然他们现在比requirements.txt
更喜欢使用Pipfile,但值得庆幸的是,您可以使用pipenv
轻松生成一个Pipfile。
尝试一下:
$ pip3 install --user pipenv
安装pipenv
$ pipenv install gunicorn
将Gunicorn添加到pipfile
$ pipenv shell
激活
我有完全相同的错误,这对我有用!
答案 5 :(得分:2)
在您的虚拟环境中安装gunicorn
pip install gunicorn
然后更新您的requirements.txt
文件
pip freeze > requirements.txt
答案 6 :(得分:1)
我错过了heroku / python buildpack 所以我去了仪表板并且:
Settings -> Add buildpack -> heroku/python
答案 7 :(得分:1)
我遇到了同样的问题,但添加后
gunicorn===<latest-version>
到 requirements.txt 文件已修复。
答案 8 :(得分:0)
就我而言,我在'Procfile'中遇到问题。
我在:
之后删除了gunicorn
。
web: gunicorn: app:app -> web: gunicorn app:app
答案 9 :(得分:0)
就我而言,发生冲突是因为我同时在同一目录/项目中拥有Pipfile
,Pipfile.lock
和requirements.txt
个文件。
Heroku并未从requirements.txt
安装任何东西,因此与这里的每个人都存在相同的gunicorn错误。
答案 10 :(得分:0)
您还需要确保在运行git push heroku master
时,要求是从Requirements.txt安装的,而不是从pipfile或pipfile.lock安装的。因此,如果要通过Requirements.txt安装依赖项,请确保从cd目录中删除了这些文件
答案 11 :(得分:0)
在requirements.txt文件中添加古尼康解决了我的问题。
答案 12 :(得分:0)
就我而言,即使gunicorn位于requirements.txt中,由于存在Pipfile,也未安装gunicorn。我从github存储库中删除了Pipfile,并成功进行了重新部署。
下面的简短教程也有助于确保我正确配置了runtime.txt,wsgi.py和Procfile的要件。
https://www.geeksforgeeks.org/deploy-python-flask-app-on-heroku/
答案 13 :(得分:0)
在我的情况下,这是因为Pipfile
中的gunicorn
在dev-packages
下。将其作为常规软件包安装即可。仅适用于Pipfile
。无需requirements.txt
。
答案 14 :(得分:0)
我不知道它为什么有效,但我遇到了同样的问题,在阅读了其他建议后,我最终删除了我的 requirements.txt 文件(即使它有 gunicorn)并再次运行 pip freeze > requirements.txt
它解决了问题。
答案 15 :(得分:0)
就我而言,我的 Heroku 应用程序缺少 python buildpack,因此没有安装任何软件包。
我通过添加一个来解决这个问题:300,000 + (3,000 * 12 * 18)
> Settings
> Buildpacks
> Add buildpack