简体   繁体   中英

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.

Now while deploying it on the cloud service Heroku, the build is failing with the following error:

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 ::

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.

It seems that you should update the distribute requirement to the with the release of distribute-0.7.3 . 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

Apart from that you can completely remove the distribute as it is not needed and it's just an example in heroku. Flask app can run without this.

Also better to use the recommend style with Pipfile instead of requirements.

A nice example of flask for heroku if you want to check https://github.com/yefim/flask-heroku-sample

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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