Cannot push to heroku


#1

Hi, I’m having this git push problem.
I was following till here:

$ git push heroku master

and I received error saying:

$ python manage.py collectstatic --noinput

and then,

 ! [remote rejected] master -> master (pre-receive hook declined)
 error: failed to push some refs to 'https://git.heroku.com/secure-island-57960.git'

What I guess is, because I cannot install wsgiref since it is not compactable with Python3 -
When I was trying to install wsgiref manually, I got error saying something is mission parenthesis.
On the top of this, I’m very confused why Heroku default installs python 2.7 while I was deploying it.


#2

=/ Unfortunately Hello Web App was written for Python 2.7 in mind, not Python 3 (working on it but it’ll be a bit before that version of the book is out.)

Do these help?


Unfortunately I think you’ll have to do a lot of Googling!


#3

Hi! I was wondering if there is any update on how to fix this. I’ve come so far! @limedaring


#4

@ehaynie63 Did you try the links I posted? Are you using Py3 or Py2.7?


#5

@limedaring I did follow those link but they were a lot for me to try to understand. So I tried setting up a virtaulenv running python 2.7 but when I try “git push heroku master” I’m still seeing the following error in the command line:

“Syntax error missing parenthesis in call to print”

I alse see this:
Building source:
remote: -----> Installing Python 3.6.1
remote: -----> Installing requirments with pip
This is where the error happens (“Syntax error missing parenthesis in call to print”)

I think most of my py files are still saved in IDE for py3.6. Not sure if this is a factor. Once, again I just started the venv after creating all my files so this may be the problem. What do you think the problem is?


#6

I think Heroku might have switched to Python 3 as their default runtime. You can still override it:

Basically make a file called “runtime.txt” with “python-2.7.13” inside of it:

echo "python-2.7.13" > runtime.txt

^ that in your terminal should do the trick. Make sure to add it to your repository and push that to Heroku.


#7

UGH HEROKU.

@ehaynie63 Can you let me know if @shazow helped?


#8

Specifying “python-2.7.13” in runtime.txt worked for me.

Keep in mind you may have to remove the old heroku app you created by typing:

heroku apps:destroy -a [app-name]

Then, redo the instructions from the section “Creating your app on Heroku.”