django开发服务器,在后台运行时如何停止 [英] django development server, how to stop it when it run in background

查看:796
本文介绍了django开发服务器,在后台运行时如何停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Clode服务器测试django小型项目,我输入manage.py runserver& ,然后注销我的cloude服务器,我可以正常访问mysite,但是当我重新加载cloude服务器时,我不知道如何停止开发服务器,我不得不终止进程以停止它,是否有办法停止

I use a clode server to test my django small project , I type in manage.py runserver & ,and then I log out my cloude server ,I can visit mysite normally but when I reload my cloude server , I don't know how to stop the development server, I had to kill the process to stop it, is there anyway to stop the development?

推荐答案

答案可以通过Google找到-并在其他论坛中找到答案。解决方案的示例是可在Unix& Linux StackExchange网站

The answer is findable via Google -- and answered in other forums. Example solution is available on the Unix & Linux StackExchange site.

要明确地说,您可以执行以下操作:

To be explicit, you could do:

ps auxw | grep runserver

这将返回进程及其各自的PID,例如:

This will return the process and its respective PID, such as:

de        7956  1.8  0.6 540204 55212 ?        Sl   13:27   0:09 /home/de/Development/sampleproject/bin/python ./manage.py runserver

在这种情况下,PID为 7956 。现在只需运行此命令即可停止它:

In this particular case, the PID is 7956. Now just run this to stop it:

kill 7956

要清楚/解决一些评论,您必须这样做,因为您是在后台运行开发服务器( & )。这就是为什么没有内置 Django停止选项的原因。

And to be clear / address some of the comments, you have to do it this way because you're running the development server in the background (the & in your command). That's why there is no "built-in" Django stop option...

这篇关于django开发服务器,在后台运行时如何停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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