2014-04-10 99 views
3

當我嘗試將Django應用程序部署到Heroku時出現拒絕錯誤。我看了一下可能的解決方案在這裏:推送被拒絕,未能編譯Python應用程序

  1. Heroku push rejected, failed to compile Python/django app (Python 2.7)

  2. Error pushing Django project to Heroku

但無論是爲我工作。

這是從發起推動的Heroku我的流程:

git push heroku master 
Initializing repository, done. 
Counting objects: 7024, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (5915/5915), done. 
Writing objects: 100% (7024/7024), 8.77 MiB | 104 KiB/s, done. 
Total 7024 (delta 2183), reused 0 (delta 0) 

-----> Python app detected 
-----> No runtime.txt provided; assuming python-2.7.6. 
-----> Preparing Python runtime (python-2.7.6) 
-----> Installing Setuptools (2.1) 
-----> Installing Pip (1.5.4) 
-----> Installing dependencies using Pip (1.5.4) 
    Downloading/unpacking Django==1.6.2 (from -r requirements.txt (line 1)) 
    Downloading/unpacking argparse==1.2.1 (from -r requirements.txt (line 2)) 
     argparse an externally hosted file and may be unreliable 
     Running setup.py (path:/tmp/pip_build_u16439/argparse/setup.py) egg_info for package argparse 

     no previously-included directories found matching 'doc/_build' 
     no previously-included directories found matching 'env24' 
     no previously-included directories found matching 'env25' 
     no previously-included directories found matching 'env26' 
     no previously-included directories found matching 'env27' 
    Downloading/unpacking distribute==0.6.24 (from -r requirements.txt (line 3)) 
     Running setup.py (path:/tmp/pip_build_u16439/distribute/setup.py) egg_info for package distribute 

     warning: no files found matching 'Makefile' under directory 'docs' 
     warning: no files found matching 'indexsidebar.html' under directory 'docs' 
    Downloading/unpacking dj-database-url==0.3.0 (from -r requirements.txt (line 4)) 
     Downloading dj_database_url-0.3.0-py2.py3-none-any.whl 
    Downloading/unpacking dj-static==0.0.5 (from -r requirements.txt (line 5)) 
     Downloading dj-static-0.0.5.tar.gz 
     Running setup.py (path:/tmp/pip_build_u16439/dj-static/setup.py) egg_info for package dj-static 

    Downloading/unpacking django-toolbelt==0.0.1 (from -r requirements.txt (line 6)) 
     Downloading django-toolbelt-0.0.1.tar.gz 
     Running setup.py (path:/tmp/pip_build_u16439/django-toolbelt/setup.py) egg_info for package django-toolbelt 

    Downloading/unpacking gunicorn==18.0 (from -r requirements.txt (line 7)) 
     Running setup.py (path:/tmp/pip_build_u16439/gunicorn/setup.py) egg_info for package gunicorn 

    Downloading/unpacking psycopg2==2.5.2 (from -r requirements.txt (line 8)) 
     Running setup.py (path:/tmp/pip_build_u16439/psycopg2/setup.py) egg_info for package psycopg2 

    Downloading/unpacking pystache==0.5.3 (from -r requirements.txt (line 9)) 
     Running setup.py (path:/tmp/pip_build_u16439/pystache/setup.py) egg_info for package pystache 
     pystache: using: version '2.1' of <module 'setuptools' from '/app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg/setuptools/__init__.pyc'> 

    Downloading/unpacking static==1.0.2 (from -r requirements.txt (line 10)) 
     Downloading static-1.0.2.tar.gz 
     Running setup.py (path:/tmp/pip_build_u16439/static/setup.py) egg_info for package static 

    Installing collected packages: Django, argparse, distribute, dj-database-url, dj-static, django-toolbelt, gunicorn, psycopg2, pystache, static 
     Running setup.py install for argparse 

     no previously-included directories found matching 'doc/_build' 
     no previously-included directories found matching 'env24' 
     no previously-included directories found matching 'env25' 
     no previously-included directories found matching 'env26' 
     no previously-included directories found matching 'env27' 
     Running setup.py install for distribute 
     Before install bootstrap. 
     Scanning installed packages 
     Setuptools installation detected at /app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg 
     Egg installation 
     Patching... 
     Renaming /app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg into /app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg.OLD.1397160440.32 
     Patched done. 
     Relaunching... 
     Traceback (most recent call last): 
      File "<string>", line 1, in <module> 
     NameError: name 'install' is not defined 
     Complete output from command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u16439/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7JPdSe-record/install-record.txt --single-version-externally-managed --compile: 
     Before install bootstrap. 

    Scanning installed packages 

    Setuptools installation detected at /app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg 

    Egg installation 

    Patching... 

    Renaming /app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg into /app/.heroku/python/lib/python2.7/site-packages/setuptools-2.1-py2.7.egg.OLD.1397160440.32 

    Patched done. 

    Relaunching... 

    Traceback (most recent call last): 

     File "<string>", line 1, in <module> 

    NameError: name 'install' is not defined 

    ---------------------------------------- 
    Cleaning up... 
    Command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u16439/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7JPdSe-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_u16439/distribute 
    Storing debug log for failure in /app/.pip/pip.log 

!  Push rejected, failed to compile Python app 

requirements.txt

Django==1.6.2 
argparse==1.2.1 
distribute==0.6.24 
dj-database-url==0.3.0 
dj-static==0.0.5 
django-toolbelt==0.0.1 
gunicorn==18.0 
psycopg2==2.5.2 
pystache==0.5.3 
static==1.0.2 
wsgiref==0.1.2 

Procfile

web: gunicorn app.wsgi 

我已經按照從Heroku的網站的說明。任何想法我失蹤?

回答

2

這顯然是一個bug in the distribute package,這似乎不太可能得到固定:

分發現在被認爲是過時和setuptools的更換。我建議用'setuptools == 1.0'或類似的替換requirements.txt中的'distribute == 0.6.28'。最新版本的pip(> = 1.4)和setuptools(> = 0.7)可以更好地支持統一代碼和升級,並設法消除像這裏遇到的問題。

1

這是已棄用的distribute軟件包的問題。請參閱Bitbucket上的Bug #91

requirements.txt文件替換distribute==0.6.24setuptools==0.7.3應該解決您的問題。

0

也有類似的問題推到Heroku的:

remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Python app detected 
remote: -----> Installing python-2.7.13 
remote:  $ pip install -r requirements.txt 
remote:  Collecting Django==1.10 (from -r /tmp/build_9bc106d48b24e071b3b58 
3f8cd5119f8/requirements.txt (line 1)) 
remote:   Downloading Django-1.10-py2.py3-none-any.whl (6.8MB) 
remote:  Collecting get==0.0.0 (from -r /tmp/build_9bc106d48b24e071b3b583f 
8cd5119f8/requirements.txt (line 2)) 
remote:   Downloading get-0.0.0.tar.gz 
remote:   Complete output from command python setup.py egg_info: 
remote:   Traceback (most recent call last): 
remote:    File "<string>", line 1, in <module> 
remote:   IOError: [Errno 21] Is a directory: '/tmp/pip-build-h774_8/ge 
t/setup.py' 
remote: 
remote:   ---------------------------------------- 
remote:  Command "python setup.py egg_info" failed with error code 1 in /t 
mp/pip-build-h774_8/get/ 
remote: !  Push rejected, failed to compile Python app. 
remote: 
remote: !  Push failed 
remote: Verifying deploy.... 
remote: 
remote: !  Push rejected to enigmatic-bastion-36926. 
remote: 
To https://git.heroku.com/enigmatic-bastion-36926.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/enigmatic-bastion-369 
26.git 

我requirements.txt:

Django==1.10 
get==0.0.0 
gunicorn==19.6.0 
olefile==0.44 
Pillow==4.0.0 
post==0.0.0 
public==0.0.0 
query-string==0.0.0 
request==0.0.0 
requests==2.12.4 
setupfiles==0.0.0 
virtualenv==15.1.0 
whitenoise==3.2 
+0

請發表你自己的問題,並鏈接到這個問題,你的問題。 – Octo

相關問題