[英]how can I put a process in background using django?
I tried os.system, os.spwanl, etc.. but it doesn't work well 我尝试过os.system,os.spwanl等。但是效果不好
I need to execute some background process from django application. 我需要从django应用程序执行一些后台进程。
该子模块为您提供了比使用os.system提供了产卵过程变得更为细化的控制。
I have used subprocess to spawn background processes from Django before. 我用的子进程来之前,从Django的产卵后台进程。 It may depend on your environment, but I had no issue using it with both modpython and modwsgi. 它可能取决于您的环境,但我同时使用modpython和modwsgi都没有问题。
I've used paramiko to put the process in background for localhost/remote hots.., 我已经使用paramiko将进程放在localhost / remote hots的后台..,
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host,user,pwd,port,.......)
si, so, se = ssh.exec_command('nohup' + cmd + '&')
so.read()
se.read()
has resolved the issue.... 已经解决了这个问题....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.