Tanay PrabhuDesai
Tanay PrabhuDesai

Reputation: 65

Unable to push a Python 3 Flask app onto Heroku

I have a simple and straight forward Python Flask app. I'm trying to deploy it on Heroku. I'm using Python 3 runtime. I can run it locally using foreman start, but it's unable to build on Heroku and rejects it.

Here is the log:

Counting objects: 29, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (25/25), done.
Writing objects: 100% (29/29), 6.08 KiB | 0 bytes/s, done.
Total 29 (delta 11), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing runtime (python-3.4.3)
remote: -----> Installing dependencies with pip
remote:        Collecting Flask==0.9 (from -r requirements.txt (line 1))
remote:          Downloading Flask-0.9.tar.gz (481kB)
remote:            Complete output from command python setup.py egg_info:
remote:            Traceback (most recent call last):
remote:              File "<string>", line 20, in <module>
remote:              File "/tmp/pip-build-r95ud3px/Flask/setup.py", line 62
remote:                print "Audit requires PyFlakes installed in your system."
remote:                                                                        ^
remote:            SyntaxError: Missing parentheses in call to 'print'
remote:            
remote:            ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r95ud3px/Flask
remote: 
remote:  !     Push rejected, failed to compile Python app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to xxxxxxxxxxxxxxxxxx.
remote: 
To https://git.heroku.com/xxxxxxxxxxxxxxxxxx.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/xxxxxxxxxxxxxxxxxx.git'

So, what exactly am I doing wrong?

Edit:

File: Procfile

web: gunicorn app:app --log-file=-

Where app.py is the main app.

File: requirements.txt

Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
gunicorn==0.17.2

File: runtime.txt

python-3.4.3

Upvotes: 2

Views: 1151

Answers (1)

doru
doru

Reputation: 9110

Flask version 0.9 doesn't have support for python 3 as it reads in the docs:

Flask 0.10 and Werkzeug 0.9 were the first versions to introduce Python 3 support.

So you should use Flask 0.10.1. Modify your requirements.txt as follows:

Flask==0.10.1
Werkzeug==0.10.4

Upvotes: 7

Related Questions