Django+vscode调试/linux_保持进程后台运行/django保持服务后台运行/ 
references 
 
 vscode+django开发教程  
  
 
断点调试 
 
 注意,新版本中生成的调试模板有justMyCode选项,该选项会影响端点生效,可以将其值修改为false(默认值是true)  
  
{
    
    
    
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}\\ll_env\\scripts\\manage.py",
            "args": [
                "runserver"
            ],
            "django": true,
            "justMyCode": false
        }
    ]
}
  
nohup 
references 
 
 
 - ‘nohup’ runs the given COMMAND with 
hangup signals ignored(也就是说,nohup 打头而启动的任务不会被hangup信号挂起,因而得以在后台保持运行(即使您退出了启动任务的shell), so that the command can continue running in the background after you log out. - ‘nohup’ does not automatically put the command it runs in the background;
 - you must do that explicitly, by 
ending the command line with an &; 
     - Also, ‘nohup’ does not alter the niceness of COMMAND; use ‘nice’ for that, e.g., ‘nohup nice COMMAND’.
   
  
 
 !!使用命令的别名可能会报错;  某些内建命令也不能够使用nohup来处理  
  
- 通过
ps aux可以看到,manage.py命令已经成为了TTY为?的进程,它的父进程号为1,因之,即使启动manage.py的shell被终止,也不会影响到django服务   
 
 启动命令为: nohup py manage.py runserver 0:8080 &  
  
# cxxu @ cxxuAli in ~/linuxShellScripts [20:34:12]
$ psh manage.py
UID        PID  PPID  C STIME TTY          TIME CMD
cxxu     14812     1  0 19:33 ?        00:00:00 py manage.py runserver 0:8080
cxxu     14820 14812  0 19:33 ?        00:00:17 /usr/bin/py manage.py runserver 0:8080
 
                
                
                
        
        
    
  
 
 |