我正在盯着django教程,当我运行命令" git push heroku master"发生这种情况
Initializing repository, done.
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (11/11), 2.14 KiB, done.
Total 11 (delta 0), 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.5 (from -r requirements.txt (line 1))
Downloading/unpacking argparse==1.2.1 (from -r requirements.txt (line 2))
Running setup.py (path:/tmp/pip_build_u33537/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_u33537/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'
Installing collected packages: Django, argparse, distribute
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.1400612619.61
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_u33537/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wPuSVj-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.1400612619.61
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_u33537/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wPuSVj-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_u33537/distribute
Storing debug log for failure in /app/.pip/pip.log
! Push rejected, failed to compile Python app
To git@heroku.com:sheltered-citadel-7550.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:sheltered-citadel-7550.git'
这是我的Procfile
web: python manage.py runserver 0.0.0.0:$PORT --noreload
这是我的requirements.txt文件
Django==1.6.5
argparse==1.2.1
setuptools==0.7.3
wsgiref==0.1.2
我已经在堆栈中搜索了一段时间,并且我已经喜欢了许多类似的问题,但是没有一个解决方案对我有用,但是我们还是有任何帮助。
答案 0 :(得分:0)
我不知道这是否是问题的根源,但看起来没有安装django-toolbelt或者你的requirements.txt没有包含所有内容。见这里:https://devcenter.heroku.com/articles/getting-started-with-django
删除requirements.txt,然后:
pip install django-toolbelt
pip freeze > requirements.txt
至少,requirements.txt应该具有(使用不同的版本):
Django==1.6
dj-database-url==0.2.2
dj-static==0.0.5
gunicorn==18.0
psycopg2==2.5.1
static==0.4
wsgiref==0.1.2