Reputation: 94
When I run the app for the first time, it is working fine but when I stop the app and try to run it again, then it gives error "Internal server error, server overloaded". It is due to the process running on that port does not get killed when the app is stopped.
I run my Flask app by,
app.run(port=5555)
And I don't want to do app.debug = True Any help on how to kill the process when the app is stopped, without debug = on
Upvotes: 0
Views: 506
Reputation: 721
You can kill the port using this command:
lsof -i:<port_number>
kill -9 <pid>
In your case, you can use something like this:
lsof -i:5555
kill -9 <pid>
Upvotes: 1