Configuring Media Tree

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.


Determines whether existing files should be deleted from storage when the corresponding object is overwritten with a new file. This prevents the creation of orphaned files. As an added benefit in the case of Django’s FileSystemStorage, if this setting is True and a file is supposed to be overwritten with a new file that has the same name, that name remains permanent because the old file will be deleted before the object is saved. If False, a random hash would be added to the new file’s name due to the existing file already occupying the desired name on disk. “”“

Default: True


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.


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

A tuple containing the columns that should be displayed in the FileNodeAdmin. Note that the browse_controls column is necessary for the admin to function properly.
A tuple containing the fields that nodes can be filtered by in the FileNodeAdmin.
A tuple containing the fields that nodes can be searched by in the FileNodeAdmin.

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.




A tuple containing all icon directories. See Installing icon sets (optional) for more information.


A dictionary of default thumbnail sizes. You can pass the dictionary key to the thumbnail templatetag instead of a numeric size.


    '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.


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.


A dictionary of options that should be applied by default when generating thumbnails. You might use this, for instance, to sharpen all thumbnails:

    'sharpen': True