title: Django signal to delete file on aws s3 not working
body: <p>I have written the pre_save signal in Django to auto-delete the user's old profile_pic if the user updates its profile_pic. This is my code.</p>
  <pre class="lang-py prettyprint-override"><code>@receiver(pre_save, sender=User)
  def delete_file_on_update(sender, instance, **kwargs):
      &quot;&quot;&quot;
      Delete the user's old profile pic file when user update the profile
      and return the status True or False i.e where old pic is deleted or
      not.
      &quot;&quot;&quot;
  
      # If instance is saving for first time in database, don't delete
      # profile_pic file.
      try:
          old_file = sender.objects.get(pk=instance.pk).profile_pic
      except sender.DoesNotExist:
          return False
  
      # If user has not updated profile pic, don't delete profile_pic
      # file.
      new_file = instance.profile_pic
      if old_file == new_file:
          return False
      
      try:
          old_file.delete(save=False)
          return True
      except Exception:
          return False
  </code></pre>
  <p>This was working fine when storage was local but when I used the AWS s3 storage, It is not deleting the old profile_pic anymore. Also on debugging this signal is get called on each pre_save of user and old_file.delete(save=false) is also executing but the file is not deleting on AWS s3.</p>