Skip to content

HTTPS clone URL

Subversion checkout URL

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