简体   繁体   中英

Getting a 500 Internal server error on my flask application, does not kill process running on a particular port when application is stopped

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM