Static Media Manager v0.4 documentation

This Page

Utilities Reference

staticmediamgr.utils.combine_files(destination, path_list)

Combine the files in path_list to create one file at destination.

Parameters:
  • destination (string) – The full file path of the resulting file
  • path_list (list) – A list of full file paths that should be combined
staticmediamgr.utils.compress_copy(src, dst, replace_files=True, compress_css=True, compress_js=True)

A wrapper around shutil.copy2 to optionally compress javascript or css files.

Parameters:
  • src (string) – The path to the original file/directory
  • dst (string) – The path to the destination file/directory
  • compress_css (bool) – Should CSS files be compressed. Default: False
  • compress_js (bool) – Should javascript files be compressed. Default: False
staticmediamgr.utils.copy(original, destination, purge=True, replace_files=True)

Do the file copying with all the appropriate error checking. Don’t replace an existing file if replace_files is False

Parameters:
  • original (string) – The path to the original file/directory
  • destination (string) – The path to the destination file/directory
  • purge (bool) – Should directories be emptied before copying. Default: settings.PURGE_OLD_FILES
  • replace_files (bool) – Should existing files be over-written (True) or kept (False). Whole directories will not be over-written. Each file within a directory will be evaluated. Default: True
staticmediamgr.utils.copy_app_media(destination='/Users/coordt/Projects/django-staticmediamgr/media2')
Copy each application’s media files to the path specified in STATIC_MEDIA_APP_MEDIA_PATH. Won’t do any of the django.contrib applications.
staticmediamgr.utils.copydir(src, dst, replace_files=True)

A port of the recursive shutil.copytree, except it assumes the destination directory exists.

Parameters:
  • src (string) – The path to the original file/directory
  • dst (string) – The path to the destination file/directory