gpt4 book ai didi

python - 推送被拒绝,无法编译 Python 应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 11:04:43 26 4
gpt4 key购买 nike

我在尝试将 Django 应用程序部署到 Heroku 时收到拒绝错误。我在这里查看了可能的解决方案:

  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

程序文件

web: gunicorn app.wsgi

我已按照 Heroku 网站上的说明进行操作。知道我错过了什么吗?

最佳答案

这显然是一个 bug in the distribute package ,这似乎不太可能得到修复:

Distribute is now considered deprecated and replaced by setuptools. I suggest replacing 'distribute==0.6.28' in requirements.txt with 'setuptools==1.0' or similar. The latest versions of pip (>=1.4) and setuptools (>=0.7) have better support for the unified code and upgrades and seek to obviate issues like the one encountered here.

关于python - 推送被拒绝,无法编译 Python 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22998190/

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