我正在尝试在heroku上部署我的第一个django应用程序并获得错误预接收挂钩拒绝

时间:2017-05-06 10:44:16

标签: django git heroku buildpack django-deployment

我已经解开了buildpacks但它没有用,我确实有requirements.txt和procfile以及虚拟环境。

 (deploy) C:\Users\Samar\Desktop\deploy\blog>git push heroku master
 Counting objects: 127, done.
 Delta compression using up to 4 threads.
 Compressing objects: 100% (122/122), done.
 Writing objects: 100% (127/127), 45.25 KiB | 0 bytes/s, done.
 Total 127 (delta 47), reused 0 (delta 0)
 remote: Compressing source files... done.
 remote: Building source:
 remote:
 remote: -----> Python app detected
 remote: -----> Installing Python 3.6.0
 remote: -----> Installing pip
 remote: -----> Installing requirements with pip remote:/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/bin/steps/pip-install: line 5: /app/.heroku/python/bin/pip: No such file or directory
 remote:  !     Push rejected, failed to compile Python app.
 remote:
 remote:  !     Push failed
 remote: Verifying deploy...
 remote:
 remote: !       Push rejected to trueblog.
 remote:To https://git.heroku.com/trueblog.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/trueblog.git'

2 个答案:

答案 0 :(得分:2)

runtime.txt中的Heroku only supports specifying a small set of python versions。他们目前只支持2.7.13或3.6.1。如果您指定任何其他运行时版本,则会得到这个完全无用的错误。

更改您的runtime.txt以使用其中一个受支持的版本。

答案 1 :(得分:0)

使用python 3.5.1时遇到了同样的问题但是当我升级到python 3.6.1时,一切正常。

创建一个runtime.txt文件并在其中添加python-3.6.1并将其放入您的manage.py文件所在的基本目录中。这应该可以解决你的问题。