Python/Flask:关闭后应用程序正在运行 [英] Python/Flask: Application is running after closing

查看:80
本文介绍了Python/Flask:关闭后应用程序正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的Flask Web应用程序.我使用Eclipse/Pydev.在使用该应用程序时,由于代码更改,我不得不非常频繁地重新启动该应用程序.这就是问题所在.运行应用程序时,可以在本地主机上看到框架,这很好.但是,当我想关闭此应用程序时,只需单击红色方块,该红色方块应会在Eclipse中停止应用程序,有时(通常),旧版本的应用程序一直在运行,因此我无法测试新版本.在这种情况下,唯一有用的是强制关闭Windows Task Manager中的每个进程.

I'm working on a simple Flask web application. I use Eclipse/Pydev. When I'm working on the app, I have to restart this app very often because of code changes. And that's the problem. When I run the app, I can see the frame on my localhost, which is good. But when I want to close this app, just click on the red square which should stop applications in Eclipse, sometimes (often), the old version of application keeps running so I can't test the new version. In this case the only thing which helps is to force close every process in Windows Task Manager.

您会给我一些如何解决此问题的建议吗?预先谢谢你.

Will you give me any advice how to manage this problem? Thank you in advance.

这可能会有所帮助:很多时候,我必须运行两次该应用程序.否则我无法连接.

This maybe helps: Many times, I have to run the app twice. Otherwise I can't connect.

推荐答案

我遇到了同样的问题并解决了它.我认为这可能会有所帮助.

I've faced the same problem and solved it. I think it may help.

当我们在本地运行基于Flask的站点时,会将其分配给TCP端口:5000和默认IP:127.0.0.1:5000

When we run a flask based site locally it is assigned to a TCP port: 5000 and the Default IP: 127.0.0.1:5000

有时,即使关闭程序或终止代码,TCP连接仍然保留.因此,该想法是终止TCP连接.您可以从命令提示符( cmd )

Sometimes TCP connection remains even after closing the program or terminating the code. So, The idea is kill the TCP connection. You can do it from command-prompt(cmd)

要遵循的两个步骤:
1.有关正在运行的TCP连接,请参阅进程ID( PID ).
转到cmd并输入:

Two Steps to Follow:
1. See the Process ID(PID) for the running TCP connection.
Go to cmd and type:

netstat -ano

  1. 按PID杀死进程.为此的命令: taskkill/f/im [PID] .下面显示了示例.

taskkill/f/im 7332

taskkill /f /im 7332

这篇关于Python/Flask:关闭后应用程序正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆