def collect(path, no_input):
    '''Collect static files'''
    if exists(path):
        msg = '"%s" directory already exists and will be erased'
        log.warning(msg, path)
        if not no_input:
            click.confirm('Are you sure?', abort=True)

        log.info('Deleting static directory "%s"', path)
        shutil.rmtree(path)

    prefix = current_app.static_url_path or current_app.static_folder
    if prefix.startswith('/'):
        prefix = prefix[1:]
    destination = join(path, prefix)
    log.info('Copying application assets into "%s"', destination)
    shutil.copytree(current_app.static_folder, destination)

    for blueprint in current_app.blueprints.values():
        if blueprint.has_static_folder:
            prefix = current_app.static_prefixes.get(blueprint.name)
            prefix = prefix or blueprint.url_prefix or ''
            prefix += blueprint.static_url_path or ''
            if prefix.startswith('/'):
                prefix = prefix[1:]

            log.info('Copying %s assets to %s', blueprint.name, prefix)
            destination = join(path, prefix)
            copy_recursive(blueprint.static_folder, destination)

    for prefix, source in current_app.config['STATIC_DIRS']:
        log.info('Copying %s to %s', source, prefix)
        destination = join(path, prefix)
        copy_recursive(source, destination)

    log.info('Done')
def collect ( path , no_input ) : if exists ( path ) : msg = '"%s" directory already exists and will be erased' log . warning ( msg , path ) if not no_input : click . confirm ( 'Are you sure?' , abort = True ) log . info ( 'Deleting static directory "%s"' , path ) shutil . rmtree ( path ) prefix = current_app . static_url_path or current_app . static_folder if prefix . startswith ( '/' ) : prefix = prefix [ 1 : ] destination = join ( path , prefix ) log . info ( 'Copying application assets into "%s"' , destination ) shutil . copytree ( current_app . static_folder , destination ) for blueprint in current_app . blueprints . values ( ) : if blueprint . has_static_folder : prefix = current_app . static_prefixes . get ( blueprint . name ) prefix = prefix or blueprint . url_prefix or '' prefix += blueprint . static_url_path or '' if prefix . startswith ( '/' ) : prefix = prefix [ 1 : ] log . info ( 'Copying %s assets to %s' , blueprint . name , prefix ) destination = join ( path , prefix ) copy_recursive ( blueprint . static_folder , destination ) for prefix , source in current_app . config [ 'STATIC_DIRS' ] : log . info ( 'Copying %s to %s' , source , prefix ) destination = join ( path , prefix ) copy_recursive ( source , destination ) log . info ( 'Done' )
Collect static files