Search code examples
pythonherokuportweb-deploymentgit-bash

Why is Heroku site not working with my app name? [Application Error]


I have pushed files from my computer to heroku using git which bundles the app to publish on the web during a Udacity course.

When I use https://git.heroku.com/mmishal001.git as per my git bash output - it gives me Method not allowed

On doing research there was a stack answer to use https://mmishal001.herokuapp.com/ but its giving me an Application Error

How can I successfully view my site?

Here are the logs:

2020-05-22T21:08:45.108618+00:00 app[api]: Initial release by user [email protected]
2020-05-22T21:08:45.108618+00:00 app[api]: Release v1 created by user [email protected]
2020-05-22T21:08:45.278750+00:00 app[api]: Release v2 created by user [email protected]
2020-05-22T21:08:45.278750+00:00 app[api]: Enable Logplex by user [email protected]
2020-05-22T21:52:19.000000+00:00 app[api]: Build started by user [email protected]
2020-05-22T21:52:46.729204+00:00 app[api]: Deploy 04bcf12c by user [email protected]
2020-05-22T21:52:46.729204+00:00 app[api]: Release v3 created by user [email protected]
2020-05-22T21:52:46.751622+00:00 app[api]: Scaled to web@1:Free by user [email protected]
2020-05-22T21:52:50.870397+00:00 heroku[web.1]: Starting process with command `python BookmarkServer.py`
2020-05-22T21:52:55.000000+00:00 app[api]: Build succeeded
2020-05-22T21:53:51.264392+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-05-22T21:53:51.314513+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-05-22T21:53:51.498696+00:00 heroku[web.1]: Process exited with status 137
2020-05-22T21:53:51.545336+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-22T21:53:51.547570+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-22T21:53:54.506792+00:00 heroku[web.1]: Starting process with command `python BookmarkServer.py`
2020-05-22T21:54:54.727943+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-05-22T21:54:54.749643+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-05-22T21:54:54.863009+00:00 heroku[web.1]: Process exited with status 137
2020-05-22T21:54:54.904317+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-22T21:59:33.545036+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mmishal001.herokuapp.com request_id=4587c886-5ab7-4677-aa98-51b0bdd23c6d fwd="92.98.87.71" dyno= connect= service= status=503 bytes= protocol=https
2020-05-22T21:59:34.335527+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mmishal001.herokuapp.com request_id=416ec5ae-4cf5-4aee-b4d6-16c0346c9aa6 fwd="92.98.87.71" dyno= connect= service= status=503 bytes= protocol=https
2020-05-22T22:00:48.204841+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mmishal001.herokuapp.com request_id=b4721bbe-2a11-4a24-abde-28c7e44436aa fwd="92.98.87.71" dyno= connect= service= status=503 bytes= protocol=https
2020-05-22T22:00:49.025113+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mmishal001.herokuapp.com request_id=c8039bf7-ae5c-4aa0-9dd9-d2a4a1100e13 fwd="92.98.87.71" dyno= connect= service= status=503 bytes= protocol=https
2020-05-22T22:02:33.399278+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mmishal001.herokuapp.com request_id=a3dd26f4-8267-4576-b86b-bf44fe0fef18 fwd="92.98.87.71" dyno= connect= service= status=503 bytes= protocol=https
2020-05-22T22:02:33.908128+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mmishal001.herokuapp.com request_id=0f31c73b-beec-4d38-b8f1-b055fbae76a0 fwd="92.98.87.71" dyno= connect= service= status=503 bytes= protocol=https

This is the port info from the .py file, .py file


Solution

  • Heroku automatically assigns your heroku app a port, so when you can't set the port to a fixed number. Heroku adds the port to the env, so you can pull it from there. Switch your listen to this:

    .listen(process.env.PORT || 5000)
    

    That way it'll still listen to port 5000 when you test locally, but it will also work on Heroku.

    check this answer https://stackoverflow.com/a/15693371/6392696