You're a fair way down this route already but I'll tell you what I would do faced with a similar situation:
1. Set up a local-only site inside Cherokee with my PHP and have it output the results in a nice format (I'd use JSON) 2. Use urllib2 and simplejson to pull the data back into Djangoland. They're both going to be a pain in the rear to maintain but I think my route looks simpler, even if it does eat more resources (which it probably would). On Thu, Apr 30, 2009 at 4:12 AM, aaron smith < beingthexemplaryli...@gmail.com> wrote: > > Hey All, > > Sorry If I don't have some of this terminology correct. Here's my > problem. I have a django app, which I'm serving with Cherokee and > FCGI. My django app manages a bunch of stuff, and has to make a couple > calls to an external soap service, to record some customer data. > > Unfortunately, I can't get the soap service working with Python. And > the people who write the service only provide php as an "official" > language. So what I'm doing is running PHP as a cli, reading > parameters, kick of to soap etc. > > The problem I'm hitting is that in Python, when I send out the php > call. It's blocking. So the request to the user on the site sits there > and waits because the soap service is jank slow. So, what I'm trying > to figure out is how to launch the PHP script from Python, but have it > detach from the current process so it finishes by itself. The php > script does all the work, I don't care about the exit code or any > STDOUT data. > > I've tried a number of methods. subprocess.Popen, os.system, etc. When > those don't work, I've even tried having python call a shell script, > which does the actual PHP call for me so I can add on the & at the end > to daemonize it. Bleh, I just can't figure out why this is not > working. To give some context into things i've tried: > > #directly calling the php script > cmd = "/usr/bin/php " > cmd += settings.CODEIGNITER_CRON_SCRIPTS_PATH+settings.INSERT_VN > cmd += " "+str(customer.id)+" "+ph+" "+fn+" "+ln+" "+amount+" &" > os.system(cmd) > > #this is the shell script which takes the args, and adds &, in the > call to the php script > cmd = settings.CODEIGNITER_CRON_SCRIPTS_PATH+"insert_virtual_number.sh" > cmd += " "+str(customer.id)+" "+ph+" "+fn+" "+ln+" "+amount > os.system(cmd) > > #using Popen to call the php script > > pid=subprocess.Popen(["/usr/bin/php",settings.CODEIGNITER_CRON_SCRIPTS_PATH+settings.INSERT_VN,str( > customer.id),ph,fn,ln,amount]).pid > > #using Popen to call the shell script version > > pid=subprocess.Popen(["/bin/bash",settings.CODEIGNITER_CRON_SCRIPTS_PATH+"insert_virtual_number.sh",str( > customer.id),ph,fn,ln,amount]).pid > > Does anyone have any pointers, or tips in the right direction? I'm so > close, arg! > > Thanks much. > A > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---