The following settings can be specified in your Django project’s settings module.
File storage class to be used for any file-related operations when dealing with media files.
This is not set by default, meaning that Django’s DEFAULT_FILE_STORAGE will be used. If you need to implement your custom storage, please refer to the relevant Django documentation on that setting and on file storage in general.
A tuple of media backends for thumbnail generation and other media-related tasks, i.e. a list of wrappers for the 3rd-party applications that take care of them.
Note
Please refer to the installation instructions for information on how to configure supported media backends.
For general information on media backends, see Using FileNodes in templates for more information.
Specifies whether exceptions caused by media backends, such as ThumbnailError, should be raised or silently ignored.
Default: settings.DEBUG
Default: 'upload'
The name of the folder under your MEDIA_ROOT where media files are stored.
Default: 'upload/_preview'
The name of the folder under your MEDIA_ROOT where cached versions of media files, e.g. thumbnails, are stored.
Default:
(
'media_tree/img/icons/mimetypes',
)
A tuple containing all icon directories. See Installing icon sets for more information.
A dictionary of default thumbnail sizes. You can pass the dictionary key to the thumbnail templatetag instead of a numeric size.
Default:
{
'small': (80, 80),
'default': (100, 100),
'medium': (250, 250),
'large': (400, 400),
'full': None, # None means: use original size
}
A whitelist of file extensions that can be uploaded. By default, this is a comprehensive list of many common media file extensions that generally shouldn’t pose a security risk.
Warning
Just because a file extension may be considered “safe”, there is absolutely no guarantee that a skilled attacker couldn’t find an exploit. You should only allow people you trust to upload files to your webserver. Be careful when adding potentially unsafe file extensions to this setting, such as executables or scripts, as this possibly opens a door to attackers.
Default: ('jpg', 'png')
A tuple of image extensions used for thumbnail files. Note that png is in there since you typically might want to preserve the file type of PNG images instead of converting them to JPG.
Default: 1000000000 # 1 GB
Maximum file size for uploaded files.
Default: True
Toggles support for SWFUpload on or off. See Installing SWFUpload for more information.
A dictionary of options that should be applied by default when generating thumbnails. You might use this, for instance, to sharpen all thumbnails:
MEDIA_TREE_GLOBAL_THUMBNAIL_OPTIONS = {
'sharpen': True
}