django - 无需控制键即可停止 Django 服务器

标签 django linux

我需要从 Linux 中的 shell 脚本终止 Django 开发服务器。既然 shell 脚本无法按住“CONTROL”键,这怎么办?是否有 sytnax 执行相同的功能? 我尝试过:

$CONTROL-C
$^C
$SIGINT

最佳答案

使用 kill 终止正在运行 Django 服务器的进程:

  • ps -ax 显示所有正在运行的进程,您可以ps -ax | grep runserver 仅显示其中包含 runserver 的进程
  • kill xxxx 杀死进程号 xxxx

关于django - 无需控制键即可停止 Django 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57807910/

相关文章:

python - Django:更新未将记录保存到数据库

python - 如何在 Django 中停止自动大写 verbose_name

python - 导入错误: No module named services Django

python fabric cd 上下文管理器不能从 Linux 到 Windows

linux - 在 shell 脚本中使用 echo 丢失字符

c - 如何从 Eclipse 中运行脚本

django - 对 Django 模板中的路径感到困惑

python - 为什么 'django.contrib.admin.sites' 没有属性 'register' ?

c++ - 在 C++ 中构造左填充的 NULL 固定长度字符数组的最有效方法是什么?

linux - bash:将列表文件放入变量中,但数组的大小为 1