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

标签 django deployment heroku

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

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

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

我不知道除了创建一个新的应用程序或heroku的存储库之外,是否有任何方法可以重置应用程序或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 [email protected]: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/

相关文章:

python - 在 Django Web 应用程序中运行异步 Python 代码

python - 为什么django无法正确提供我的SPA静态文件?

ruby-on-rails - 部署Rails应用程序之前我需要做些什么?

python - 无法从 JWT 导入 TokenObtainPairView、TokenRefreshView

python - 使用 BitNami 镜像在 EC2 上部署 Django 项目

hibernate - Grails 部署在 Tomcat6 上

heroku - 在 Heroku 中为 Phoenix 框架设置 MIX_ENV

node.js - npm 安装失败 - make 失败

javascript - 简单的 Node.js 故障排除 - 从 app.get() 接收 404

django haystack SearchField 索引为 False