将Django应用程序部署到Heroku时找不到Pip

时间:2014-05-27 17:15:37

标签: python django heroku pip heroku-toolbelt

我正在尝试将一个python 2.7.5 Django应用程序部署到heroku,但是当heroku编译项目时我收到错误。 具体来说,问题似乎是pip,以及尝试安装时。

我试过的第一个,我得到了这个错误:“没有这样的选择: - 允许所有外部”。

Heroku输出:

PS C:\(...)> git push heroku master
Fetching repository, done.
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 499 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.4.
-----> Using Python runtime (python-2.7.4)
-----> Installing Setuptools (3.6)
/tmp/buildpack_6eb68b54-a764-4ebb-ab28-cde543457862/bin/compile: line 186: cd: /tmp/buildpack_6eb68b54-a764-4ebb-ab28-cd
e543457862/vendor/setuptools-3.6/: No such file or directory
-----> Installing Pip (1.5.5)
/tmp/buildpack_6eb68b54-a764-4ebb-ab28-cde543457862/bin/compile: line 193: cd: /tmp/buildpack_6eb68b54-a764-4ebb-ab28-cd
e543457862/vendor/pip-1.5.5/: No such file or directory
-----> Installing dependencies using Pip (1.5.5)

Usage:
  pip install [options] <requirement specifier> ...
  pip install [options] -r <requirements file> ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: --allow-all-external

 !     Push rejected, failed to compile Python app

To git@heroku.com:(...).git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:(...).git'

然后,我尝试添加一个指定python版本的runtime.txt文件:

python-2.7.5

之后,当我再次尝试部署时,当Heroku尝试安装pip时,我遇到了一个不同的错误:     “没有这样的文件或目录”

heroku给出的输出是:

C:\(...)> git push heroku master
Fetching repository, done.
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 770 bytes, done.
Total 7 (delta 4), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Python app detected
-----> Found python-2.7.4, removing.
-----> Preparing Python runtime (python-2.7.5)
-----> Installing Setuptools (3.6)
/tmp/buildpack_06aca65d-4039-4d30-aadb-0746f6052aab/bin/compile: line 186: cd: /tmp/buildpack_06aca65d-4039-4d30-aadb-07
46f6052aab/vendor/setuptools-3.6/: No such file or directory
-----> Installing Pip (1.5.5)
/tmp/buildpack_06aca65d-4039-4d30-aadb-0746f6052aab/bin/compile: line 193: cd: /tmp/buildpack_06aca65d-4039-4d30-aadb-07
46f6052aab/vendor/pip-1.5.5/: No such file or directory
-----> Installing dependencies using Pip (1.5.5)
/tmp/buildpack_06aca65d-4039-4d30-aadb-0746f6052aab/bin/compile: line 224: /app/.heroku/python/bin/pip: No such file or
directory

 !     Push rejected, failed to compile Python app

To git@heroku.com:(...).git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:(...).git'

在本地,我使用pip 1.3.1,但heroku使用1.5.5。这可能是问题吗?有什么想法吗?

提前致谢

1 个答案:

答案 0 :(得分:0)

看起来您正在使用自定义构建包,我猜这是问题 - 您的自定义buildpack没有包含pip。我建议删除你的自定义buildpack,然后再试一次。

您可以通过运行以下命令删除构建包:

heroku config:unset BUILDPACK_URL