繁体   English   中英

将Django应用部署到Heroku时找不到点

[英]Pip not found when deploying Django app to Heroku

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

我尝试的第一个错误是:“没有这样的选择:--allow-all-external”。

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。 这可能是问题吗? 有什么想法吗?

提前致谢

看来您使用的是自定义构建包,而我猜这就是问题所在-您的自定义构建包中没有pip。 我建议删除您的自定义buildpack,然后重试。

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

heroku config:unset BUILDPACK_URL

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM