How to get Intellij-idea close Flask dev server properly? How to get Intellij-idea close Flask dev server properly? flask flask

How to get Intellij-idea close Flask dev server properly?


I guess what happens is that you start your flask app which then is forking the development server as a new process. If you stop the app the forked process is still running.

This looks like a problem, that cannot easily be solved within the means of your IDE. You could add something to your main to kill the already running server process, before starting the app again, but that seems ugly.

But why don't you just start your app with app.run(debug=True) as described in flask doc? The server will reload automatically everytime you changed your app so you don't have to stop and restart it manually.

EDIT:Something a bit quirky just came to my mind: if you just need a comfortable way to kill the server from within the IDE all you have to do is to introduce a syntactical error in one of the places the reloader monitors, save the file and the server will choke on it and die :)


This doesn't happen anymore with newer versions (tested with PyCharm 2.0)