Port error when deploying dash app to heroku

I am trying to deploy the following dash app using Heroku: Data_Science_Projects/app1.py at main · tghannam/Data_Science_Projects · GitHub
But i am always getting the error:

Address already in use
Port 51264 is in use by another program. > Either identify and stop that program, or start the server with a different port.

The port number changes every time i deploy the app, but the error message is the same. Can’t tell what the problem is.

Any help is much appreciated. Thanks

Hello @tararu,

I think you need to do this:

if __name__ == '__main__':
    app.run_server(debug=True, use_reloader=False )

Right now, you are telling the script to run when gunicorn is trying to spin up the server itself.

That works… Thanks a lot.