Flask - 因Pip失败导致应用部署失败
我之前在Heroku上部署了几个应用程序,主要是为了学习。今天我用Flask创建了一个新应用,按照Heroku网站上的说明进行操作。问题出现在我需要用pip安装其他东西的那一步。
(venv)kiddo@kiddo-LIFEBOOK-LH531:~/Documents/Projects/workspace/hellowork$ pip install Flask gunicorn
Downloading/unpacking Flask
Downloading Flask-0.10.1.tar.gz (544Kb): 544Kb downloaded
Running setup.py egg_info for package Flask
warning: no files found matching '*' under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'tests'
warning: no previously-included files matching '*.pyo' found under directory 'tests'
warning: no previously-included files matching '*.pyc' found under directory 'examples'
warning: no previously-included files matching '*.pyo' found under directory 'examples'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_themes/.git' ...
..... 后面还有其他的错误。从这一点开始,我就无法在Heroku上部署了,因为总是会出现额外的错误,和上面的错误一起出现:
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.1395994594.37
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_u56661/distribute/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-y13sLM-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_u56661/distribute
Storing debug log for failure in /app/.pip/pip.log
! Push rejected, failed to compile Python app
To git@heroku.com:quiet-meadow-5679.git
我的requirements.txt文件:
Flask==0.10.1
Jinja2==2.7.2
MarkupSafe==0.19
Werkzeug==0.9.4
argparse==1.2.1
distribute==0.6.24
gunicorn==18.0
itsdangerous==0.23
wsgiref==0.1.2
我在使用Ubuntu,所有的包都是最新的。我之前从来没有遇到过这个问题,已经花了几个小时在这上面了。如果有人知道怎么解决这个问题,我会非常感激。
顺便说一下,应用在本地用foreman运行得很好。
谢谢
2 个回答
0
你有没有试过联系Heroku的客服呢?看起来在发生这个问题的时候,Heroku可能遇到了API方面的故障。你应该联系他们的客服(然后再试着部署一次)。
1
我联系了Heroku的客服,他们告诉我问题出在我本地的包和Heroku服务器上的包之间。解决这个问题的方法就是把requirements.txt文件里的distribute==0.6.24这一行删掉。
他们还更新了说明页面,所以我们需要把所有包更新到最新版本,才能顺利部署应用。