当我尝试git push我的应用程序时,Heroku使用了错误的requirements.txt

时间:2018-09-03 23:29:54

标签: django git heroku

我正在尝试首次将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

1 个答案:

答案 0 :(得分:0)

const fs = require('fs');

let filename = "D:\\temp\\temp.zip";    
fs.unlinkSync(filename);

因此您部署了错误的分支。在$ git show master:requirements.txt | grep psycopg2 psycopg2==2.6.2 中部署deployheroku或更新requirements.txt