title: Django: start a process in a background thread?
body: <p>I'm trying to work out how to run a process in a background thread in Django. I'm new to both Django and threads, so please bear with me if I'm using the terminology wrong.</p>
  
  <p>Here's the code I have. Basically I'd like <code>start_processing</code> to begin as soon as the <code>success</code> function is triggered. However <code>start_processing</code> is the kind of function that could easily take a few minutes or fail (it's dependent on an external service over which I have no control), and I don't want the user to have to wait for it to complete successfully before the view is rendered. ('Success' as far as they are concerned isn't dependent on the result of <code>start_processing</code>; I'm the only person who needs to worry if it fails.)</p>
  
  <pre><code>def success(request, filepath):
      start_processing(filepath)
      return render_to_response('success.html', context_instance = RequestContext(request))
  </code></pre>
  
  <p>From the Googling I've done, most people suggest that background threads aren't used in Django, and instead a cron job is more suitable. But I would quite like <code>start_processing</code> to begin as soon as the user gets to the success function, rather than waiting until the cron job runs. Is there a way to do this?</p>