def is_media_request(request):
 parsed_media_url = urlparse(settings.MEDIA_URL)
 if request.path_info.startswith(parsed_media_url.path):
  if parsed_media_url.netloc:
   if (request.get_host() == parsed_media_url.netloc):
    return True
  else:
   return True
 return False

def is_media_request ( request ) : parsed_media_url = urlparse ( settings . MEDIA_URL ) if request . path_info . startswith ( parsed_media_url . path ) : if parsed_media_url . netloc : if ( request . get_host ( ) == parsed_media_url . netloc ) : return True else : return True return False
check if a request is a media request .