如何关闭 python simpleHTTPserver? [英] How do I shut down a python simpleHTTPserver?

查看:69
本文介绍了如何关闭 python simpleHTTPserver?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在尝试学习 d3,wiki 建议

So I'm trying to learn d3, and the wiki suggested that

要在本地查看示例,您必须有本地 Web 服务器.任何网络服务器将工作;例如,您可以运行 Python 的内置服务器:

To view the examples locally, you must have a local web server. Any web server will work; for example you can run Python's built-in server:

python -m SimpleHTTPServer 8888 &

太好了……现在我有一台服务器正在运行……但在某个时候我想我可能应该再次关闭它.

Great... only now I have a server running... but at some point I think I should probably shut that down again.

有没有比使用 kill 更好的关闭它的方法?对于一份小工作来说,这似乎是一把大锤.

Is there a better way of shutting it down than using kill <pid>? That seems like kind of a big hammer for a little job.

(我运行的是 Mac OS 10.6.8 (Snow Leopard))

(I'm running Mac OS 10.6.8 (Snow Leopard))

FWIW:ctrl+c 给出了大约 10 行回溯,抱怨被中断.

FWIW: ctrl+c gives about 10 lines of traceback, complaining about being interrupted.

kill -3 在单独的窗口Python 意外退出"中给出 Finder 警告.

kill -3 <pid> gives a Finder warning in a separate window 'Python quit unexpectedly'.

默认的 kill kill -15 相对干净(和简单).

The default kill <pid> and kill -15 <pid> are relatively clean (and simple).

推荐答案

您只是向进程发送信号.kill 是发送这些信号的命令.

You are simply sending signals to the processes. kill is a command to send those signals.

键盘命令Ctrl+C发送SIGINT,kill -9发送SIGKILL,kill -15 发送一个 SIGTERM.

The keyboard command Ctrl+C sends a SIGINT, kill -9 sends a SIGKILL, and kill -15 sends a SIGTERM.

您想向服务器发送什么信号来结束它?

What signal do you want to send to your server to end it?

这篇关于如何关闭 python simpleHTTPserver?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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