简体   繁体   English

将Django项目推送到Heroku时出错

[英]Error pushing Django project to Heroku

I've been trying to fix this error for about an hour now and I've ran out of solutions so please help me. 我一直试图修复这个错误大约一个小时了,我已经用完了解决方案所以请帮助我。

heroku create heroku创造

runs fine no problems 运行没问题

git push heroku master 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'

requirements file: 要求文件:

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

procfile procfile

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

Heroku Logs: 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

I was able to get this running by: 我能够通过以下方式运行:

  1. cloning your git repo 克隆你的git repo
  2. removing the virtualenv==1.8.4 from your requirements.txt 从您的requirements.txt删除virtualenv==1.8.4
  3. git add .
  4. git commit -m "removing virtualenv requirement"
  5. git push heroku master

I'm assuming you did not git add . 我假设你没有git add . and git commit after removing the virtualenv from your requirements. 从您的要求中删除virtualenv后,然后执行git commit Any changes you make to a git repo will not go in effect, for both github and heroku , until you add and then commit the changes locally, and finally push them to remote repository ie Github or Heroku . git repo所做的任何更改都不会对githubheroku ,直到你在本地add然后commit更改,最后push它们push送到远程存储库,即GithubHeroku

The error message indicates that it can't find virtualenv==1.8.4.post1 and when I try that command locally, I get the same error. 错误消息表明它找不到virtualenv==1.8.4.post1 ,当我在本地尝试该命令时,我得到了同样的错误。 It doesn't look like that version exists at pypi. 看起来pypi上不存在该版本。 Try changing your requirements.txt to virtualenv==1.8.4 ? 尝试将requirements.txt更改为virtualenv==1.8.4

对于heroku部署,你不需要require.txt文件中的virtualenv == 1.8.4.post1 ,请删除它并将proc文件和需求放在git的根目录中。

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

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