sandbox/tasks.py
def remove_expired_env():
    """Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION."""
    current_time = time.time()
    
    for f in os.listdir(settings.ENVIRONMENT_ROOT):
        path = os.path.join(settings.ENVIRONMENT_ROOT, f)
        creation_time = os.path.getctime(path)
        
        if (current_time - creation_time) >= settings.ENVIRONMENT_EXPIRATION:
            os.remove(path) if os.path.isfile(path) else shutil.rmtree(path)
            logger.info(f"environment {f} has expired and has been deleted.")
Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION.
Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION.
Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION .
def remove_expired_env():
    current_time = time.time()
    for f in os.listdir(settings.ENVIRONMENT_ROOT):
        path = os.path.join(settings.ENVIRONMENT_ROOT, f)
        creation_time = os.path.getctime(path)
        if (current_time - creation_time) >= settings.ENVIRONMENT_EXPIRATION:
            os.remove(path) if os.path.isfile(path) else shutil.rmtree(path)
            logger.info(f"environment {f} has expired and has been deleted.")
def remove_expired_env ( ) : current_time = time . time ( ) for f in os . listdir ( settings . ENVIRONMENT_ROOT ) : path = os . path . join ( settings . ENVIRONMENT_ROOT , f ) creation_time = os . path . getctime ( path ) if ( current_time - creation_time ) >= settings . ENVIRONMENT_EXPIRATION : os . remove ( path ) if os . path . isfile ( path ) else shutil . rmtree ( path ) logger . info ( f"environment {f} has expired and has been deleted." )
Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION.
Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION .
"""Remove every file of MEDIA_ROOT that are expired according to ENVIRONMENT_EXPIRATION."""