(image_file)
Delete file from disc.
Delete file from disc.
Delete file from disc .
def delete_file(image_file):
    """Delete file from disc."""
    try:
        # Delete the main file.
        file_path = os.path.join(settings.MEDIA_ROOT, image_file)
        os.remove(file_path)

        # Delete the sized version of it.
        files = glob.glob("{0}*".format(file_path))
        for _file in files:
            try:
                os.remove(_file)
            except Exception as err:
                logger.debug(str(err))

        # If all goes well...
        return True
    except Exception as err:
        logger.debug(str(err))
        return False
def delete_file ( image_file ) : try : # Delete the main file. file_path = os . path . join ( settings . MEDIA_ROOT , image_file ) os . remove ( file_path ) # Delete the sized version of it. files = glob . glob ( "{0}*" . format ( file_path ) ) for _file in files : try : os . remove ( _file ) except Exception as err : logger . debug ( str ( err ) ) # If all goes well... return True except Exception as err : logger . debug ( str ( err ) ) return False