3

I use IDEA 10.5 for my Flask experimentation. Flask has en embedded test server (like Django does)

When I launch my test class, the dev server launches as well on port 5000. All good. * Running on http://127.0.0.1:5000/

When I click on the "Stop process" button (red square), I get the message saying the process is finished : Process finished with exit code 143

However the server is still alive (responds to requests) and I can see I still have a python process running.

Obviously this prevents me from relaunching the test straight away, I have to kill the server process first.

How do you manage to get both your program and the server ending at the same time ?

4

2 回答 2

0

我想会发生什么是你启动你的烧瓶应用程序,然后将开发服务器作为一个新进程分叉。如果您停止应用程序,则分叉的进程仍在运行。

这看起来像是一个问题,在您的 IDE 范围内无法轻易解决。在再次启动应用程序之前,您可以在 main 中添加一些东西来杀死已经运行的服务器进程,但这看起来很难看。

app.run(debug=True) 但是你为什么不按照flask doc中的描述来启动你的应用程序呢?每次您更改应用程序时,服务器都会自动重新加载,因此您不必手动停止并重新启动它。

编辑: 我突然想到了一些奇怪的东西:如果您只需要一种舒适的方式从 IDE 中杀死服务器,您所要做的就是在重新加载器监控的地方之一引入语法错误,保存文件服务器会窒息而死:)

于 2011-07-08T07:14:04.943 回答
0

新版本不再发生这种情况(使用 PyCharm 2.0 测试)

于 2011-12-28T14:34:09.247 回答