Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 189 lines (131 sloc) 6.338 kB
0562972 @samluescher doc improvements
authored
1 Installing Media Tree
e4cb864 @samluescher doc improvements
authored
2 *********************
3
a1b845a @samluescher Doc fixes
authored
4 This document assumes you are familiar with Python and Django.
e4cb864 @samluescher doc improvements
authored
5
6
a1b845a @samluescher Doc fixes
authored
7 Dependencies
8 ============
9
10 Make sure to install these packages prior to installation:
11
f60d51d @samluescher Added links to docs
authored
12 - `Django <>`_ >= 1.2.5
13 - `South <http://south.aeracode.org/>`_ >= 0.7.2
14 - `django-mptt <https://github.com/django-mptt/django-mptt>`_ > 0.4.2 (see :ref:`install-mptt`)
15 - `PIL <http://www.pythonware.com/products/pil/>`_ >= 1.1
a1b845a @samluescher Doc fixes
authored
16
4025042 @samluescher Install doc improvements
authored
17
a1b845a @samluescher Doc fixes
authored
18 Getting the code
19 ================
20
f60d51d @samluescher Added links to docs
authored
21 For the latest stable version (recommended), use `pip <http://pypi.python.org/pypi/pip>`_ (or, alternatively, easy_install)::
a1b845a @samluescher Doc fixes
authored
22
23 $ pip install django-media-tree
24
4025042 @samluescher Install doc improvements
authored
25 **Alternatively**, if you would like to use the latest development version,
26 you can also install it using ``pip``::
a1b845a @samluescher Doc fixes
authored
27
4025042 @samluescher Install doc improvements
authored
28 $ pip install -e git://github.com/philomat/django-media-tree#egg=django-media-tree
a1b845a @samluescher Doc fixes
authored
29
4025042 @samluescher Install doc improvements
authored
30 **or** download it from http://github.com/philomat/django-media-tree and run the
31 installation script::
a1b845a @samluescher Doc fixes
authored
32
4025042 @samluescher Install doc improvements
authored
33 $ python setup.py install
34
35 .. Note::
43500d9 @samluescher Doc fixes
authored
36 In case you get a permission error, you will probably have to run the above
37 commands with root permissions, i.e. enter ``sudo pip install …`` and
4025042 @samluescher Install doc improvements
authored
38 ``sudo python setup.py install``.
a1b845a @samluescher Doc fixes
authored
39
40
41 Basic setup
42 ===========
43
04f75d3 @samluescher Made settings configurabe. Doc fixes.
authored
44 - In your project settings, add ``mptt`` and ``media_tree`` to the
45 ``INSTALLED_APPS``::
e4cb864 @samluescher doc improvements
authored
46
47 INSTALLED_APPS = (
e804754 @samluescher Doc fixes
authored
48 # ... your other apps here
e4cb864 @samluescher doc improvements
authored
49 'mptt',
50 'media_tree',
51 )
52
a1b845a @samluescher Doc fixes
authored
53 - If you are using ``django.contrib.staticfiles`` (recommended), just run the
54 usual command to collect static files::
e4cb864 @samluescher doc improvements
authored
55
1f944c1 @samluescher Doc fixes
authored
56 $ python manage.py collectstatic
e4cb864 @samluescher doc improvements
authored
57
a1b845a @samluescher Doc fixes
authored
58 .. Note::
4025042 @samluescher Install doc improvements
authored
59 Please refer to the Django documentation on how to `set up the static files
60 app <https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/>`_ if you
61 have not done that yet.
62
c0cb2ef @samluescher Doc fixes
authored
63 If you are **not** going to use the ``staticfiles`` app, you will have to copy
64 the contents of the ``static`` folder to the location you are serving static files
65 from.
4025042 @samluescher Install doc improvements
authored
66
c0cb2ef @samluescher Doc fixes
authored
67 - Create the database tables::
4025042 @samluescher Install doc improvements
authored
68
69 $ python manage.py syncdb
70
498716c @samluescher Doc fixes
authored
71 Alternatively, if you are using `South <http://south.aeracode.org/>`_ in your
72 project, you'll have to use a slightly different command::
4025042 @samluescher Install doc improvements
authored
73
74 $ python manage.py syncdb --all
75 $ python migrate media_tree --fake
e804754 @samluescher Doc fixes
authored
76
be1dc4c @samluescher Doc fixes
authored
77 .. _configuring-media-backends:
e804754 @samluescher Doc fixes
authored
78
f52ecf6 @samluescher Doc fixes
authored
79 - **Configuring media backends (optional)**: If you want thumbnails to be
80 generated, which will usually be the case, you need to install the appropriate
81 media backend that takes care of this. Currently, `easy-thumbnails
82 <https://github.com/SmileyChris/easy-thumbnails>`_ is the only recommended and
83 officially supported 3rd-party application.
84
85 After you've installed the ``easy_thumbnails`` module, configure Media Tree to
86 use it by defining ``MEDIA_TREE_MEDIA_BACKENDS`` in your project settings::
e4cb864 @samluescher doc improvements
authored
87
88 MEDIA_TREE_MEDIA_BACKENDS = (
a1bac97 @samluescher Doc fixes
authored
89 'media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend',
e4cb864 @samluescher doc improvements
authored
90 )
91
92 .. Note::
f52ecf6 @samluescher Doc fixes
authored
93 In principle, Media Tree can work together with any other thumbnail
94 generating app, provided that you write the appropriate media backend class
95 to support it. Please have a look at one of the backends under
96 ``media_tree.contrib.media_backends`` if you are interested in using your
97 own specific 3rd-party app.
e4cb864 @samluescher doc improvements
authored
98
107708c @samluescher Doc fixes
authored
99 .. _install-swfupload:
100
4e35939 @samluescher Doc fixes
authored
101 - **Configuring the uploader (optional, recommended)**: If you are planning to use a Flash uploader such as
30d4151 @samluescher Doc fixes
authored
102 ``SWFUpload``, add ``SessionPostMiddleware`` to your ``MIDDLEWARE_CLASSES``, before the standard
103 ``SessionMiddleware``::
107708c @samluescher Doc fixes
authored
104
105 MIDDLEWARE_CLASSES = (
106 # ...
107 'media_tree.middleware.SessionPostMiddleware',
108 # Notice that ``SessionPostMiddleware`` goes before ``SessionMiddleware``
109 'django.contrib.sessions.middleware.SessionMiddleware',
110 )
111
e804754 @samluescher Doc fixes
authored
112 - **Optional**: Also add any Media Tree extensions that you are planning to use
113 to your ``INSTALLED_APPS``::
e4cb864 @samluescher doc improvements
authored
114
115 INSTALLED_APPS = (
e804754 @samluescher Doc fixes
authored
116 # ... your other apps here
e4cb864 @samluescher doc improvements
authored
117 'media_tree.contrib.media_extensions.images.focal_point',
118 'media_tree.contrib.media_extensions.zipfiles',
119 )
120
85cd0a0 @samluescher Edited docs/installation.rst via GitHub
authored
121 .. Note::
122 See :ref:`bundled-extensions` for a list of default extensions included in the project.
ea3c9bc @samluescher Edited docs/installation.rst via GitHub
authored
123
a1b845a @samluescher Doc fixes
authored
124
4025042 @samluescher Install doc improvements
authored
125 .. _install-mptt:
126
127
128 Note on django-mptt
129 ===================
130
131 A version of ``django-mptt`` **newer than 0.4.2** is required because there is
132 an issue with older versions not indenting the folder list correctly. **Either**
43500d9 @samluescher Doc fixes
authored
133 install a recent version::
4025042 @samluescher Install doc improvements
authored
134
e94b660 @samluescher Doc fix
authored
135 $ pip install -e git://github.com/django-mptt/django-mptt.git@0.5.1#egg=django-mptt
4025042 @samluescher Install doc improvements
authored
136
a1acd35 @samluescher Doc fixes
authored
137 **or**, if for some reason you can't install a recent version, you can resolve the
4025042 @samluescher Install doc improvements
authored
138 situation by putting ``legacy_mptt_support`` in your ``INSTALLED_APPS`` **before**
139 ``mptt``. This will be deprecated in the future::
140
141 INSTALLED_APPS = (
142 # ... your other apps here
143 'media_tree.contrib.legacy_mptt_support',
144 'mptt',
145 'media_tree',
146 )
147
148
722270f @samluescher Doc fixes
authored
149 .. _install-icon-sets:
a1b845a @samluescher Doc fixes
authored
150
151 Installing icon sets
152 ====================
153
154 By default, Media Tree only comes with plain file and folder icons. If you would
155 like to use custom icon sets that are more appropriate for your specific media
156 types, you can install them like a Django application, and configure Media Tree
722270f @samluescher Doc fixes
authored
157 to use them as follows.
a1b845a @samluescher Doc fixes
authored
158
159 - In order to install an icon set, simply add the respective module to your
160 ``INSTALLED_APPS`` setting::
161
162 INSTALLED_APPS = (
163 # ... your other apps here
164 'my_custom_icon_set',
165 )
166
167 - If you are using ``django.contrib.staticfiles`` (recommended), just run the
168 usual command to collect static files::
169
170 $ ./manage.py collectstatic
171
172 If you are **not** using the ``staticfiles`` app, copy the contents of the
173 ``static`` folder to the static root of your project.
174
722270f @samluescher Doc fixes
authored
175 - Define ``MEDIA_TREE_ICON_DIRS`` in your project settings, and add the static
176 path containing the new icon files, e.g.::
a1b845a @samluescher Doc fixes
authored
177
178 MEDIA_TREE_ICON_DIRS = (
179 'my_custom_icons/64x64px', # the new folder under your static root
180 'media_tree/img/icons/mimetypes', # default icon folder
181 )
182
183 .. Note::
184 You can add several icon sets to this tuple, and for each media file the
185 first appropriate icon that is encountered will be used. Please notice
186 that on the last line we are specifying the default icon location,
187 which will be used as a fallback in case no appropriate icon is found in
188 one of the custom sets.
Something went wrong with that request. Please try again.