Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 157 lines (110 sloc) 5.136 kb
0562972 Samuel Luescher doc improvements
authored
1 Installing Media Tree
e4cb864 Samuel Luescher doc improvements
authored
2 *********************
3
a1b845a Samuel Luescher Doc fixes
authored
4 This document assumes you are familiar with Python and Django.
e4cb864 Samuel Luescher doc improvements
authored
5
6
a1b845a Samuel Luescher Doc fixes
authored
7 Dependencies
8 ============
9
10 Make sure to install these packages prior to installation:
11
e804754 Samuel Luescher Doc fixes
authored
12 - Django >= 1.2.5
13 - south >= 0.7.2
14 - django-mptt > 0.4.2
15 - PIL >= 1.1
a1b845a Samuel Luescher Doc fixes
authored
16
17 Getting the code
18 ================
19
20 For the latest stable version (recommended), use ``pip`` or ``easy_install``::
21
22 $ pip install django-media-tree
23
24 **Alternatively**, you can also download the latest development version from
25 http://github.com/philomat/django-media-tree and run the installation script::
26
27 $ python setup.py install
28
29 **or** use ``pip``::
30
31 $ pip install -e git://github.com/philomat/django-media-tree#egg=django-media-tree
32
33
34 Basic setup
35 ===========
36
37 - In your project settings, add ``media_tree`` to the ``INSTALLED_APPS``::
e4cb864 Samuel Luescher doc improvements
authored
38
39 INSTALLED_APPS = (
e804754 Samuel Luescher Doc fixes
authored
40 # ... your other apps here
e4cb864 Samuel Luescher doc improvements
authored
41 'mptt',
42 'media_tree',
43 )
44
e804754 Samuel Luescher Doc fixes
authored
45 - A version of ``django-mptt`` **newer than 0.4.2** is required because there is
46 an issue with older versions not indenting the folder list correctly. There
1cad004 Samuel Luescher Doc fixes
authored
47 are two ways of resolving this. If you can't use a newer version, put
e804754 Samuel Luescher Doc fixes
authored
48 ``legacy_mptt_support`` in your ``INSTALLED_APPS`` **before** ``mptt``::
49
50 INSTALLED_APPS = (
51 # ... your other apps here
52 'media_tree.contrib.legacy_mptt_support',
53 'mptt',
54 'media_tree',
55 )
56
57 Alternatively, you can use the current development version of
58 ``django-mptt``::
59
60 $ sudo pip install -e git://github.com/django-mptt/django-mptt#egg=django-mptt
61
a1b845a Samuel Luescher Doc fixes
authored
62 - If you are using ``django.contrib.staticfiles`` (recommended), just run the
63 usual command to collect static files::
e4cb864 Samuel Luescher doc improvements
authored
64
722270f Samuel Luescher Doc fixes
authored
65 $ ./manage.py collectstatic
e4cb864 Samuel Luescher doc improvements
authored
66
a1b845a Samuel Luescher Doc fixes
authored
67 If you are **not** using the ``staticfiles`` app, copy the contents of the
68 ``static`` folder to the static root of your project.
69
70 .. Note::
71 To learn about the ``staticfiles`` app please refer to the
72 `respective Django documentation
73 <https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/>`_.
e804754 Samuel Luescher Doc fixes
authored
74
be1dc4c Samuel Luescher Doc fixes
authored
75 .. _configuring-media-backends:
e804754 Samuel Luescher Doc fixes
authored
76
77 - **Optional**: If you want thumbnails to be generated, which will usually be
78 the case, you need to install the appropriate media backend that takes care of
79 this. Currently, ``easy_thumbnails`` is the recommended 3rd-party application.
e4cb864 Samuel Luescher doc improvements
authored
80
81 After you've installed ``easy_thumbnails``, configure Media Tree to use it by
a1b845a Samuel Luescher Doc fixes
authored
82 defining ``MEDIA_TREE_MEDIA_BACKENDS`` in your project settings::
e4cb864 Samuel Luescher doc improvements
authored
83
84 MEDIA_TREE_MEDIA_BACKENDS = (
a1bac97 Samuel Luescher Doc fixes
authored
85 'media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend',
e4cb864 Samuel Luescher doc improvements
authored
86 )
87
88 .. Note::
c5e30b6 Samuel Luescher Doc fixes
authored
89 In principle, Media Tree can work together with any other thumbnail generating
90 app, provided that you write the appropriate media backend class to support
91 it. Please have a look at one of the backends under
92 ``media_tree.contrib.media_backends`` if you are interested in using your own
93 specific 3rd-party app.
e4cb864 Samuel Luescher doc improvements
authored
94
e804754 Samuel Luescher Doc fixes
authored
95 - **Optional**: Also add any Media Tree extensions that you are planning to use
96 to your ``INSTALLED_APPS``::
e4cb864 Samuel Luescher doc improvements
authored
97
98 INSTALLED_APPS = (
e804754 Samuel Luescher Doc fixes
authored
99 # ... your other apps here
e4cb864 Samuel Luescher doc improvements
authored
100 'media_tree.contrib.media_extensions.images.focal_point',
101 'media_tree.contrib.media_extensions.zipfiles',
102 )
103
722270f Samuel Luescher Doc fixes
authored
104 .. _install-swfupload:
105
e804754 Samuel Luescher Doc fixes
authored
106 - **Optional**: If you are planning to use a Flash uploader such as
107 ``SWFUpload``, add ``SessionPostMiddleware`` to your ``MIDDLEWARE_CLASSES``::
e4cb864 Samuel Luescher doc improvements
authored
108
109 MIDDLEWARE_CLASSES = (
110 # ...
111 'media_tree.middleware.SessionPostMiddleware',
112 # Notice that ``SessionPostMiddleware`` goes before ``SessionMiddleware``
113 'django.contrib.sessions.middleware.SessionMiddleware',
114 )
115
a1b845a Samuel Luescher Doc fixes
authored
116
722270f Samuel Luescher Doc fixes
authored
117 .. _install-icon-sets:
a1b845a Samuel Luescher Doc fixes
authored
118
119 Installing icon sets
120 ====================
121
122 By default, Media Tree only comes with plain file and folder icons. If you would
123 like to use custom icon sets that are more appropriate for your specific media
124 types, you can install them like a Django application, and configure Media Tree
722270f Samuel Luescher Doc fixes
authored
125 to use them as follows.
a1b845a Samuel Luescher Doc fixes
authored
126
127 - In order to install an icon set, simply add the respective module to your
128 ``INSTALLED_APPS`` setting::
129
130 INSTALLED_APPS = (
131 # ... your other apps here
132 'my_custom_icon_set',
133 )
134
135 - If you are using ``django.contrib.staticfiles`` (recommended), just run the
136 usual command to collect static files::
137
138 $ ./manage.py collectstatic
139
140 If you are **not** using the ``staticfiles`` app, copy the contents of the
141 ``static`` folder to the static root of your project.
142
722270f Samuel Luescher Doc fixes
authored
143 - Define ``MEDIA_TREE_ICON_DIRS`` in your project settings, and add the static
144 path containing the new icon files, e.g.::
a1b845a Samuel Luescher Doc fixes
authored
145
146 MEDIA_TREE_ICON_DIRS = (
147 'my_custom_icons/64x64px', # the new folder under your static root
148 'media_tree/img/icons/mimetypes', # default icon folder
149 )
150
151 .. Note::
152 You can add several icon sets to this tuple, and for each media file the
153 first appropriate icon that is encountered will be used. Please notice
154 that on the last line we are specifying the default icon location,
155 which will be used as a fallback in case no appropriate icon is found in
156 one of the custom sets.
Something went wrong with that request. Please try again.