Background service, SimpleHTTPServer and AJAX
<p>I'm new to Python and I'm having some issues with asynchronous calls and webservers.</p>

<p>I have a SimpleHTTPServer communicating via AJAX with a website that lets you start and stop a service in the host.</p>

<p>The problem is that I don't get my HTTP:201 until the call has ended, which never happens since this is a long running process.</p>

<p>I have tried with call, having my cmd inside a shell script that executes 'cmd &amp;' also tried with Popen, which I though is was non-blocking.</p>

<p>I also tried with thread.start_new_thread(os.system, (cmd,))</p>

<pre><code>def do_POST(self):
    # ... some code to get args ...
    subprocess.Popen([cmd, args])

    # I'd like 'cmd args' to run in the server while I return my HTTP:201 here
    self.send_response(201)
    self.end_headers()
    self.wfile.write(output)
</code></pre>
