gpt4 book ai didi

django - 将 Django 应用程序部署到 Heroku 时的 pip 问题

转载 作者:行者123 更新时间:2023-12-04 05:39:57 24 4
gpt4 key购买 nike

尝试将我的 Django 应用程序部署到 Heroku 时遇到问题。

它提示安装 facebook-sdk 库的问题,但实际上有requirements.txt 中没有这样的东西文件。

我已经试过用 -f 推送标志,我注释掉了 requirements.txt 中的行。我什至推送了一个空的需求文件,但问题仍然存在。

我不知道除了创建一个新的之外,是否有任何方法可以重置应用程序或 heroku 的存储库?有什么我可以尝试的想法吗?

控制台日志:

$ git push prod master
Counting objects: 52282, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (17957/17957), done.
Writing objects: 100% (52282/52282), 138.01 MiB | 137 KiB/s, done.
Total 52282 (delta 33410), reused 48501 (delta 30768)

-----> Heroku receiving push
-----> Python/Django app detected
-----> Preparing Python interpreter (2.7.2)
-----> Creating Virtualenv version 1.7
New python executable in .heroku/venv/bin/python2.7
Also creating executable in .heroku/venv/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
Running virtualenv with interpreter /usr/local/bin/python2.7
-----> Activating virtualenv
-----> Installing dependencies using pip version 1.0.2
error: The requested URL returned error: 401 while accessing http://github.com/facebook/python-sdk.git/info/refs

fatal: HTTP request failed
Downloading/unpacking paramiko (from -r requirements.txt (line 17))
Creating supposed download cache at /app/tmp/repo.git/.cache/pip_downloads
Storing download in cache at /app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fparamiko%2Fparamiko-1.7.7.2.zip
Running setup.py egg_info for package paramiko

Obtaining facebook-sdk from git+http://github.com/facebook/python-sdk.git#egg=facebook-sdk (from -r requirements.txt (line 23))
Cloning http://github.com/facebook/python-sdk.git to ./.heroku/src/facebook-sdk
Complete output from command /usr/bin/git clone -q http://github.com/facebook/python-sdk.git /tmp/build_1bn5oykhrmms7/.heroku/src/facebook-sdk:

----------------------------------------
Command /usr/bin/git clone -q http://github.com/facebook/python-sdk.git /tmp/build_1bn5oykhrmms7/.heroku/src/facebook-sdk failed with error code 128
Storing complete log in /app/.pip/pip.log
! Heroku push rejected, failed to compile Python/django app

最佳答案

正确的解决方案是“Maxime R.”在 how to pip uninstall with virtualenv on heroku cedar stack? 上的解决方案

heroku labs:enable user_env_compile heroku config:add CLEAN_VIRTUALENV=true

Currently this won't work because there is a bug. You'll need to use my fork of the buildpack until this get fixed upstream :

heroku config:add BUILDPACK_URL=git@github.com:blaze33/heroku-buildpack-python.git

Now push your new code and you'll notice that the whole virtualenv gets reinstalled.

Andrey's answer no longer works since March 23 2012. The new style virtualenv commit moved the virtual env from /app to /app/.heroku/venv but the purge branch wasn't updated to catch up so that you end up with a virtualenv not being in PYTHONHOME.



经过多次使用 heroku run 命令尝试后,我终于成功地应用了 Maxime R. 解决方案。此外,我已经打开了 Heroku 票证,并且 Heroku 支持已向我确认这是解决方案。

关于django - 将 Django 应用程序部署到 Heroku 时的 pip 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11381989/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com