Static Media Manager v0.4 documentation
The configuration of which path(s) should be copied where. It consists of a tuple of dicts. Each dict requires a from key and a to key.
STATIC_MEDIA_COPY_PATHS = (
{'from': MEDIA_ROOT, 'to': '/mnt/MediaServer/media/'},
)
If you are copying everything from your MEDIA_ROOT, the above configuration would suffice. You can get more specific, as well.
STATIC_MEDIA_COPY_PATHS = (
{'from': MEDIA_ROOT+'/css/', 'to': '/mnt/MediaServer/media/css/'},
{'from': MEDIA_ROOT+'/js/', 'to': '/mnt/MediaServer2/media/js/'},
{'from': MEDIA_ROOT+'/img/', 'to': '/mnt/MediaServer3/media/img/'},
)
The string in the from entry can be relative to the project path, or absolute. It can point to a file or a directory.
When copying a directory, should the directory at the new location be emptied first (True) or left as-is (False). The default is True.
Should CSS files be compressed using a port of the YUI Compressor when copied (True) or left as-is (False). The default is False.
The compression simply removes excess whitespace and comments and shortens colors and zero measurements. It does not alter any rules or combine any rule attributes. See CSS Compression for more detailed information.
Should Javascript files be compressed using a port of Douglas Crockford’s jsmin. The default is False.
Which external javascript compression command to use. The command string can use %(outfile)s and %(infile)s placeholders. If the value is None then the internal jsmin library is used when STATIC_MEDIA_COMPRESS_JS is True. The default is None (Use the internal compression)
Where should the contents of the media directory inside each entry in INSTALLED_APPS be installed? If the value is None then application media will not be copied. The default is MEDIA_ROOT.
Application media will not overwrite existing files, so it is possible for you to override one, several or all of the files in a given application’s media.
List of apps to exclude when copying media to APP_MEDIA_PATH. Needs to match the name as listed in INSTALLED_APPS.
The media for Django’s contrib.admin application doesn’t follow the de facto standard of enclosing an app’s media within a directory of the app’s name; its css files are in css, its images are in img, etc.
To avoid potential conflicts with other media, this setting allows you to add the admin media into a directory within your STATIC_MEDIA_APP_MEDIA_PATH. By default, it is admin-media.
Make sure you set your ADMIN_MEDIA_PREFIX to /admin-media/ or whatever else you set this to.
A dictionary mapping a (new) file to a combination/concatenation of several other files. The concatenation is done in the order of the list. The resulting file will be compressed according to the COMPRESS_CSS and COMPRESS_JS settings.
For example, to combine three CSS files into one combo.css file:
STATIC_MEDIA_FILE_COMBINATIONS = {
MEDIA_ROOT+'/css/combo.css': [
MEDIA_ROOT+'/css/base.css',
MEDIA_ROOT+'/css/forms.css',
MEDIA_ROOT+'/css/coolui.css'],
}
Note
File combinations are done before anything else, so make the destination path for combination files be in a directory configured in a from key in STATIC_MEDIA_COPY_PATHS.
The original files are not touched and the destination file can safely reside with them. The default setting is an empty dictionary.
In order to segregate user uploaded content from the site content, you can use the STATIC_URL and the static url staticmediamgr.context_processor.static_url to keep things separate.
The default is STATIC_URL = MEDIA_URL