简体   繁体   English

在Heroku上部署Flask应用会导致构建错误

[英]Deploying Flask app on Heroku giving build error

I have come up with a flask app in python which is running fine on localhost server. 我想出了在python上运行烧瓶的应用程序,该应用程序在localhost服务器上运行良好。

Now while deploying it on the cloud service Heroku, the build is failing with the following error: 现在,在将其部署到云服务Heroku上时,构建失败并显示以下错误:

remote:          Downloading distribute-0.6.24.tar.gz (620kB)
remote:            Complete output from command python setup.py egg_info:
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-_ofp1xky/distribute/setuptools/__init__.py", line 2, in <module>
remote:                from setuptools.extension import Extension, Library
remote:              File "/tmp/pip-install-_ofp1xky/distribute/setuptools/extension.py", line 2, in <module>
remote:                from setuptools.dist import _get_unpatched
remote:              File "/tmp/pip-install-_ofp1xky/distribute/setuptools/dist.py", line 103
remote:                except ValueError, e:
remote:                                 ^
remote:            SyntaxError: invalid syntax
remote:            
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_ofp1xky/distribute/
remote:  !     Push rejected, failed to compile Python app.

Below is my requirements.txt :: 以下是我的requirements.txt ::

docutils==0.11

MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2

requests==1.2.0
Flask==0.10.1
Jinja2==2.6
Werkzeug==0.8.3
certifi==0.0.8
chardet==1.0.1
distribute==0.6.24
gunicorn==0.14.2

Please help! 请帮忙! Thanks Newbie to Flask. 感谢新手Flask。

It seems that you should update the distribute requirement to the with the release of distribute-0.7.3 . 似乎您应该使用distribute-0.7.3的发行版将distribute要求更新为。 Keep in mind also that heroku supports latest python but you can change the runtime if you want to support https://devcenter.heroku.com/articles/python-runtimes 还要记住,heroku支持最新的python,但是如果您想支持https://devcenter.heroku.com/articles/python-runtimes,则可以更改运行时。

Apart from that you can completely remove the distribute as it is not needed and it's just an example in heroku. 除此之外,您可以完全删除distribute因为它不是必需的,这只是heroku中的一个示例。 Flask app can run without this. Flask应用程序无需此即可运行。

Also better to use the recommend style with Pipfile instead of requirements. 最好将推荐样式与Pipfile结合使用,而不是与要求结合使用。

A nice example of flask for heroku if you want to check https://github.com/yefim/flask-heroku-sample 如果您想检查https://github.com/yefim/flask-heroku-sample,则为heroku烧瓶的一个很好的例子

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

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