title: How to run a Django post_save signal as a background process?
body: <p>I have a <a href="https://docs.djangoproject.com/en/1.8/ref/signals/#post-save" rel="nofollow">post_save</a> attached to a model which loads a substantial amount of information via json response from an external API when it is created. Unfortunately this takes long enough that heroku times out before it ever has a chance of finishing. </p>
  
  <p>After doing some research is seems the best way to do this is as a background process. </p>
  
  <p><strong>What would be the best way to run a post_save signal asynchronously?</strong>  </p>
  
  <p>After reading about celery it seems too heavy-weight for one process. Are there other methods that are trusted?</p>
  
  <pre><code>from django.db.models.signals import post_save
  import urllib2
  import json
  
  class Foobar(models.Model):
      # ... fields ... #
  
  def foobar_post_save(sender, instance, created, *args, **kwargs):
      """Load info from external API
  
      data
      ----
      sender - The model class. (Foobar)
      instance - The actual instance being saved.
      created - Boolean; True if a new record was created.
      *args, **kwargs - Capture the unneeded `raw` and `using`(1.3) arguments.
      """
  
      if created:
          url_to_open = &lt;api_url&gt;
          resp = urllib2.urlopen(url_to_open)
          data = json.loads(resp.read())
          # ... load data ... #
  
  post_save.connect(foobar_post_save, sender=Foobar)
  </code></pre>