python - 将 Django 项目推送到 Heroku 时出错

标签 python django heroku python-2.7

我已经尝试修复这个错误大约一个小时了,但我已经用完了所有解决方案,所以请帮助我。

heroku create

运行良好没有问题

git push heroku master

    Counting objects: 119, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (118/118), done.
Writing objects: 100% (119/119), 1.39 MiB | 66 KiB/s, done.
Total 119 (delta 4), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.34)
-----> Installing Pip (1.2.1)
-----> Installing dependencies using Pip (1.2.1)
       Downloading/unpacking Django==1.4.3 (from -r requirements.txt (line 1))
         Running setup.py egg_info for package Django

       Downloading/unpacking dj-database-url==0.2.1 (from -r requirements.txt (line 2))
         Downloading dj-database-url-0.2.1.tar.gz
         Running setup.py egg_info for package dj-database-url

       Downloading/unpacking psycopg2==2.4.6 (from -r requirements.txt (line 3))
         Running setup.py egg_info for package psycopg2

           no previously-included directories found matching 'doc/src/_build'
       Downloading/unpacking virtualenv==1.8.4.post1 (from -r requirements.txt (line     4))
         Could not find a version that satisfies the requirement virtualenv==1.8.4.post1 (from -r requirements.txt (line 4)) (from versions: )
       No distributions matching the version for virtualenv==1.8.4.post1 (from -r requirements.txt (line 4))
       Storing complete log in /app/.pip/pip.log
 !     Heroku push rejected, failed to compile Python app

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

需求文件:

 >Django==1.4.3
 >dj-database-url==0.2.1
 >psycopg2==2.4.6
 >virtualenv==1.8.4.post1

过程文件

web: python manage.py runserver 0.0.0.0:$PORT --noreload

Heroku 日志:

    The 'heroku' gem has been deprecated and replaced with the Heroku Toolbelt, download and install from https://toolbelt.heroku.com.

2013-01-24T01:22:06+00:00 heroku[api]: Enable Logplex by [private email]@yahoo.com
2013-01-24T01:22:06+00:00 heroku[api]: Release v2 created by [private email]@yahoo.com
2013-01-24T01:22:42+00:00 heroku[slugc]: Slug compilation started
2013-01-24T01:23:38+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
2013-01-24T01:43:26+00:00 heroku[slugc]: Slug compilation started
2013-01-24T01:43:51+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
2013-01-24T02:27:36+00:00 heroku[slugc]: Slug compilation started
2013-01-24T02:28:08+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
2013-01-24T02:32:08+00:00 heroku[slugc]: Slug compilation started
2013-01-24T02:32:32+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
2013-01-24T02:43:32+00:00 heroku[slugc]: Slug compilation started
2013-01-24T02:43:59+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
2013-01-24T02:46:23+00:00 heroku[slugc]: Slug compilation started
2013-01-24T02:46:52+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app
2013-01-24T02:49:48+00:00 heroku[slugc]: Slug compilation started
2013-01-24T02:50:26+00:00 heroku[slugc]: Slug compilation failed: failed to compile Python app

最佳答案

我能够通过以下方式运行它:

  1. 克隆你的 git 仓库
  2. requirements.txt 中删除 virtualenv==1.8.4
  3. git add .
  4. git commit -m "删除 virtualenv 要求"
  5. git push heroku master

我假设您在从您的要求中删除 virtualenv 后没有git add .git commit。对于 githubheroku,您对 git 存储库所做的任何更改都不会生效,直到您添加 然后在本地提交更改,最后将它们推送到远程存储库,即 GithubHeroku

关于python - 将 Django 项目推送到 Heroku 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14492538/

相关文章:

python - 在函数中生成坐标的二元素元组

heroku - Heroku 计费的最短时间是多少?

node.js - Facebook 开发者问题 - 'URL couldn' 待验证。响应与预期挑战不符'

node.js - 无法在 git 部署 Node 服务器上推送到 heroku

ajax - 使用 JQuery 和 Django 上传图像

python - 从arduino收集 'double'类型数据

python - 将一些数组保存在同一个文件中

python - 带约束的简单线性回归

django - 按用户过滤反向关系,并在 Django Rest Framework 中仅返回一个对象

django - 筛选相关模型django