Jack022
Jack022

Reputation: 1287

Python webapp not running properly on Heroku?

I tried to deploy this application on Heroku. When i launch it locally on my laptop it runs properly, but after deploying it on Heroku to see the outcome i encountered some problems: i can see the whole frontend of the app online but the random numbers are not appearing dynamically on the webpage.

I don't know how to debug it, because on my Heroku console no errors are showing up, so i'm not getting any error at all. Any advice?

My procfile looks like this:

web: gunicorn --worker-class eventlet -w 1 orig:app

Edit 1: I opened my Google Chrome console and found this:

Mixed Content: The page at 'https://fast-everglades-74376.herokuapp.com/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://fast-everglades-74376.herokuapp.com/socket.io/?EIO=3&transport=websocket&sid=2e9895ef6415455eac51294746b3edf6'. This endpoint should be available via WSS. Insecure access is deprecated.

socket.io.min.js:1 POST http://fast-everglades-74376.herokuapp.com/socket.io/?EIO=3&transport=polling&t=1540729336006-41&sid=f550b39a0e1e4544b1eee0c3f1719871 400 (BAD REQUEST)

Also, on Firefox Console i'm getting another error about Mixed Active Content

Edit 2: I changed the version of my Gunicorn module from 19.3 to 18.0 and after that i tried to run the page on http instead of https. On http it seems to run, the problem is that it won't run on https right now.

Upvotes: 2

Views: 264

Answers (1)

Dinko Pehar
Dinko Pehar

Reputation: 6071

Regarding deployment to heroku, you need to install eventlet for socket-io apps to run. Also, you need a Procfile. It basically tells heroku "apps" how to run. In my example here, just put that one line:

web: gunicorn -k eventlet python_file:flask_variable_name

In you example it would be I think

web: gunicorn -k eventlet application:app

Also, when deploying, be sure to add Procfile from heroku dashboard and set it to "On".

Upvotes: 2

Related Questions