views:

171

answers:

4

I tried os.system, os.spwanl, etc.. but it doesn't work well

I need to execute some background process from django application.

+6  A: 

Try to use celery. It was originally created for this purpose and also supports scheduling tasks.

dragoon
A: 

The subprocess module gives you much finer-grained control over spawning processes than afforded by os.system.

bjlaub
A: 

I have used subprocess to spawn background processes from Django before. It may depend on your environment, but I had no issue using it with both modpython and modwsgi.

emperorcezar
A: 

I've used paramiko to put the process in background for 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....

Tumbleweed