簡體   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