title: How to delete an image using default_storage.delete(file_name) in Django View?
body: <p>So I have been creating a <strong>Fingerprint Matching system using Django Rest Framework</strong>. Whenever I send a fingerprint from frontend to backend to match with the stored fingerprints. The fingerprint is getting stored there which is not what I want. I want to delete it once it's use is over.</p>
  <p>Here is the Error Image: <a href="https://i.stack.imgur.com/MCXcv.png" rel="nofollow noreferrer">https://i.stack.imgur.com/MCXcv.png</a></p>
  <pre><code>def post(self, request, format = None):
      serializer = serializers.MatchSerializer(data = request.data)
  
      if serializer.is_valid():
  
          #Fetching the stored fingerprints in a different serializer.
          queryset = models.Profile.objects.all()
          serializer2 = serializers.ProfileSerializer(queryset, many=True)
          data = serializer2.data
  
          #Initialized a result list which will be appended with the name of the user whose 
          #fingerprint is matched.
      
          result = []
         
          file = request.FILES['fingerprint']
          file_name = default_storage.save(file.name, file)
  
          file = default_storage.open(file_name) 
          file_url = default_storage.url(file_name)
          fImage = cv2.imread(str(file))
  
          for i in range(len(data)):
              print(data[i].get('fingerprint'))
              DbImage = cv2.imread('C:/Users/ShalomAlexander/Documents/4th Year 
                         Project/Django/FingerprintMatch/' + data[i].get('fingerprint'))
  
              if(isMatch(fImage, DbImage)): 
                  result.append(data[i].get('name'))
          
          #This is not working as expected because its raising an error ie. &quot; Process is still 
          #in use&quot;    
          default_storage.delete(file_name)
  
          return Response(result)
  </code></pre>
  <p>If you have any better approach to match fingerprints or images that will also be appreciated. Thanks in advance. The current code works fine and matches the fingerprint as expected but its storing the incoming fingerprint image and I don't want that.</p>