django - 当我尝试 git push 我的应用程序时,Heroku 使用了错误的 requirements.txt
问题描述
我正在尝试第一次将 django 应用程序安装到 Heroku。我一直在关注教程,直到git push heroku master
. 我收到 postgrequl/psycopg2 错误:
Collecting psycopg2==2.6.2 (from -r /tmp/build_9a1b9401a05f6186e32ef1f993bdd183/requirements.txt (line 10))
remote: Downloading blah...blah../bc/psycopg2-2.6.2.tar.gz (376kB)
remote: Complete output from command python setup.py egg_info:
remote: running egg_info
remote: creating pip-egg-info/psycopg2.egg-info
remote: writing pip-egg-info/psycopg2.egg-info/PKG-INFO
remote: writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
remote: writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
remote: writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
remote: Error: could not determine PostgreSQL version from '10.5'
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mu5yzi1s/psycopg2/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to django-randomizer.
我进行了一些搜索,并阅读了其他人遇到问题的地方,因为他们使用的是旧版本的 psycopg2。所以我编辑了我的 requirements.txt 文件以包含psycopg2-2.7.5
,这是最新的。我想再次尝试“git push heroku master”,我得到了同样的错误。该错误引用 psycopg2-2.6.2。
我什至删除了我的应用程序并重新开始,但是当涉及到 git push 时,我得到了同样的错误。目前我认为 git 处于某种状态,它一直在尝试进行已经失败的推送。不过我不确定。有任何想法吗?
git reflog:
5fd142e (HEAD -> deployheroku, origin/deployheroku) HEAD@{0}: pull origin deployheroku: Fast-forward
df048a9 (origin/master, origin/HEAD, master) HEAD@{1}: reset: moving to HEAD^
5fd142e (HEAD -> deployheroku, origin/deployheroku) HEAD@{2}: commit: change settings and wsgi for heroku
df048a9 (origin/master, origin/HEAD, master) HEAD@{3}: checkout: moving from master to deployheroku
df048a9 (origin/master, origin/HEAD, master) HEAD@{4}: commit: restore local version
873d636 HEAD@{5}: commit: updated psycopg2 in requirements.txt
aebfe43 HEAD@{6}: commit: get files ready for heroku
6273553 HEAD@{7}: commit: removed old files
9b2c347 HEAD@{8}: commit: update with new app name
6b4103d HEAD@{9}: clone: from https://github.com/shmish/django-randomizer.git
我的 requirements.txt 是:
certifi==2018.8.13
chardet==3.0.4
defusedxml==0.5.0
Django==2.0.8
django-allauth==0.36.0
django-filter==2.0.0
docopt==0.6.2
idna==2.7
oauthlib==2.1.0
psycopg2==2.7.5
python-decouple==3.1
python3-openid==3.1.0
pytz==2018.5
requests==2.19.1
requests-oauthlib==1.0.0
urllib3==1.23
whitenoise==4.0
yarg==0.1.9
解决方案
$ git show master:requirements.txt | grep psycopg2
psycopg2==2.6.2
所以你部署了一个错误的分支。在. deployheroku
_ requirements.txt
_master
推荐阅读
- ios - 当firebase身份验证重定向到recapcha窗口时隐藏活动指示器(iOS - Swift)
- flutter - 如何颤动可移动、可拖动和可滚动的菜单浮动操作按钮
- thymeleaf - 我找不到变量百里香。为什么?
- algorithm - Lite 反馈顶点集
- typescript - 如何在打字稿中转换反应过渡组代码?
- wpf - 如何在wpf中覆盖选定的单选按钮背景
- python - 有没有其他方法可以在 pycharm 上创建语句?
- java - 重复条目:META-INF/services/javax.annotation.processing.Processor
- nginx - 400:nginx 中的错误请求开始出现,日志中没有任何内容,浏览器中没有该站点的缓存
- php - 为什么在 Laravel 项目中会出现这个插入错误?