1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Installation — Chimère v2.0 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Chimère v2.0 documentation" href="index.html" />
<link rel="next" title="Upgrade" href="upgrade.html" />
<link rel="prev" title="Welcome to Chimère’s documentation!" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="upgrade.html" title="Upgrade"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to Chimère’s documentation!"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Chimère v2.0 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Author:</th><td class="field-body">Étienne Loks</td>
</tr>
<tr class="field"><th class="field-name">date:</th><td class="field-body">2012-10-08</td>
</tr>
<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">CC-BY 3.0</td>
</tr>
</tbody>
</table>
<p>This document presents the installation of Chimère.
It has been updated for version 2.0.0.</p>
<div class="section" id="prerequisites">
<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2>
<blockquote>
<div><ul class="simple">
<li><a class="reference external" href="http://www.apache.org/">apache</a> version 2.x</li>
<li><a class="reference external" href="http://www.python.org/">python</a> versions 2.6 or 2.7</li>
<li><a class="reference external" href="http://www.djangoproject.com/">django</a> >= version 1.4</li>
<li><a class="reference external" href="http://south.aeracode.org/">south</a></li>
<li><a class="reference external" href="http://www.postgresql.org/">postgres</a> >= version 8.x</li>
<li><a class="reference external" href="http://www.gnu.org/software/gettext/">gettext</a></li>
<li><a class="reference external" href="http://freshmeat.net/projects/psycopg/">psycopg2</a></li>
<li><a class="reference external" href="http://www.pythonware.com/products/pil/">Python Imaging Library</a></li>
<li><a class="reference external" href="http://tilloy.net/dev/pyexiv2/">pyexiv2</a></li>
<li><a class="reference external" href="http://www.crummy.com/software/BeautifulSoup/">Beautiful Soup</a></li>
<li>python-simplejson</li>
<li>python-gdal</li>
<li><a class="reference external" href="http://pypi.python.org/pypi/Unidecode">unidecode</a></li>
<li><a class="reference external" href="http://lxml.de/">lxml</a></li>
<li><a class="reference external" href="http://jquery.com/">jquery</a> version 1.7.1 or better</li>
<li><a class="reference external" href="http://jqueryui.com/">jquery-ui</a></li>
<li><a class="reference external" href="https://code.google.com/p/feedparser/">Universal Feed Parser</a></li>
</ul>
</div></blockquote>
<p>geodjango is a part of django since version 1.0 but it has some specific
(geographically related) additional dependencies:</p>
<blockquote>
<div><ul class="simple">
<li><a class="reference external" href="http://trac.osgeo.org/geos/">geos</a> 3.0.x</li>
<li><a class="reference external" href="http://trac.osgeo.org/proj/">proj.4</a> 4.4 to 4.6</li>
<li><a class="reference external" href="http://postgis.refractions.net/">postgis</a> versions 1.2.1 or 1.3.x</li>
<li><a class="reference external" href="http://www.gdal.org/">gdal</a></li>
</ul>
</div></blockquote>
<p>Optionaly (but recommanded):</p>
<blockquote>
<div><ul class="simple">
<li><a class="reference external" href="http://tinymce.moxiecode.com/">tinymce</a></li>
<li><a class="reference external" href="http://www.gpsbabel.org/">gpsbabel</a></li>
<li>django-celery if you want to manage large imports</li>
</ul>
</div></blockquote>
<p>The simpliest way to obtain these packages is to get them from your favorite
Linux distribution repositories. For instance on Debian Wheezy:</p>
<div class="highlight-python"><pre>apt-get install apache2 python python-django python-django-south \
postgresql-9.1 gettext python-psycopg2 python-imaging \
python-pyexiv2 python-beautifulsoup python-simplejson python-gdal \
javascript-common python-lxml libjs-jquery libjs-jquery-ui \
python-feedparser libgeos-3.3.3 proj-bin postgresql-9.1-postgis \
gdal-bin tinymce gpsbabel python-django-celery \</pre>
</div>
<p>On Debian Squeeze (you need to activate backports):</p>
<div class="highlight-python"><pre>apt-get install -t squeeze-backports python-django libjs-jquery
apt-get install apache2 python python-django python-django-south \
postgresql-8.4 gettext python-psycopg2 python-imaging \
python-pyexiv2 python-beautifulsoup python-simplejson python-gdal \
javascript-common python-lxml libjs-jquery libjs-jquery-ui \
python-feedparser libgeos-3.2.0 proj-bin postgresql-8.4-postgis \
gdal-bin tinymce gpsbabel \</pre>
</div>
<p>If these packages do not exist in your distribution’s repository, please refer
to the applications’ websites.</p>
</div>
<div class="section" id="database-configuration">
<h2>Database configuration<a class="headerlink" href="#database-configuration" title="Permalink to this headline">¶</a></h2>
<p>Now that postgres and postgis are installed, you need to create a new user for
chimere:</p>
<div class="highlight-python"><pre>su postgres
createuser --echo --adduser --createdb --encrypted --pwprompt chimere-user</pre>
</div>
<p>Then, you have to create the database and initialize the geographic types (adapt
the paths accordingly to your needs):</p>
<div class="highlight-python"><pre>PG_VERSION=9.1 # 8.4 for debian Squeeze
createdb --echo --owner chimere-user --encoding UNICODE chimere "My Chimère database"
createlang plpgsql chimere # only necessary on Debian Squeeze
psql -d chimere -f /usr/share/postgresql/$PG_VERSION/contrib/postgis-1.5/postgis.sql
psql -d chimere -f /usr/share/postgresql/$PG_VERSION/contrib/postgis-1.5/spatial_ref_sys.sql</pre>
</div>
</div>
<div class="section" id="install-the-sources">
<h2>Install the sources<a class="headerlink" href="#install-the-sources" title="Permalink to this headline">¶</a></h2>
<p>Choose a path to install your Chimère:</p>
<div class="highlight-python"><pre>INSTALL_PATH=/var/local/django
mkdir $INSTALL_PATH</pre>
</div>
<div class="section" id="from-an-archive">
<h3>From an archive<a class="headerlink" href="#from-an-archive" title="Permalink to this headline">¶</a></h3>
<p>The last “stable” version is available in this <a class="reference external" href="http://www.peacefrogs.net/download/chimere/">directory</a>.
Take care of getting the last version in the desired X.Y branch (for instance
the last version for the 1.0 branch is version 1.0.2.
Extract it to the desired destination path:</p>
<div class="highlight-python"><pre>wget http://www.peacefrogs.net/download/chimere -q -O -| html2text
(...)
[[ ]] chimere-1.0.0.tar.bz2 17-Nov-2010 16:51 53K
[[ ]] chimere-1.0.1.tar.bz2 17-Nov-2010 16:51 53K
[[ ]] chimere-1.0.2.tar.bz2 17-Nov-2010 16:51 53K
(...)
wget http://www.peacefrogs.net/download/chimere/chimere-1.0.2.tar.bz2</pre>
</div>
<p>Download, unpack and move the files in an apache user (www-data for Debian)
readable directory:</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH
tar xvjf chimere-last.tar.bz2
chown -R myusername:www-data chimere</pre>
</div>
</div>
<div class="section" id="from-the-git-repository">
<h3>From the git repository<a class="headerlink" href="#from-the-git-repository" title="Permalink to this headline">¶</a></h3>
<p>Another solution is to get the last git version:</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH
git clone git://www.peacefrogs.net/git/chimere
cd chimere
git tag -l # list tagged versions
git checkout v2.0 # checkout the desired version</pre>
</div>
</div>
</div>
<div class="section" id="create-a-custom-project-template">
<h2>Create a custom project template<a class="headerlink" href="#create-a-custom-project-template" title="Permalink to this headline">¶</a></h2>
<p>There a default project is provided (example_project). Copy and modify it (or
get another project based on Chimere):</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH/chimere
cp -ra example_project mychimere_project</pre>
</div>
<p>Your project name is used for the name of the Python package of your template.
As a Python package it should follow the rule of Python variable name:
it must be at least one letter and can have a string of numbers, letters and
underscores (“_”) to any length. Don’t begin the name by “_” because it has
special significance in Python.</p>
<p>In your chimere application directory create local_settings.py to fit to your
configuration.
A base template is provided (local_settings.py.example) and short descriptions of
the more relevant fields are given below (at least check them). Most of these
settings are initialized in settings.py.</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH/chimere/mychimere_project
cp local_settings.py.sample local_settings.py
vim local_settings.py</pre>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Fields:</th><td class="field-body"><ul class="first last simple">
<li>DATABASES: parameters for the database</li>
<li>PROJECT_NAME: name of the project</li>
<li>SECRET_KEY: a secret key for a particular Django installation. This is
used to provide cryptographic signing, and should be set to a unique,
unpredictable value. Change it!</li>
<li>ROOT_URLCONF: url configuration for your project something like:
‘mychimere_project.urls’</li>
<li>EMAIL_HOST: smtp of an email server to send emails</li>
<li>TINYMCE_URL: url to tinymce path (default is appropriate for a Debian
installation with tinymce activated)</li>
<li>JQUERY_JS_URLS: list of Jquery and Jquery-ui urls (default is appropriate
for a Debian installation with Jquery and Jquery-ui activated)</li>
<li>JQUERY_CSS_URLS: list of Jquery and Jquery-ui urls (default is appropriate
for a Debian installation with Jquery and Jquery-ui activated)</li>
<li>GPSBABEL: path to gpsbabel (default is appropriate for a Debian
installation with gpsbabel installed)</li>
<li>TIME_ZONE: local time zone for this installation</li>
<li>LANGUAGE_CODE: language code for this installation</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Manage media path permission:</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH/chimere/mychimere_project
chown -R user:www-data media
chmod -R g+w media</pre>
</div>
<p>Create log file:</p>
<div class="highlight-python"><pre>mkdir /var/log/django
touch /var/log/django/chimere.log
chown -R root:www-data /var/log/django/
chmod -R g+w /var/log/django/</pre>
</div>
<p>Regroup static files in one path:</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH/chimere/mychimere_project
./manage.py collectstatic</pre>
</div>
</div>
<div class="section" id="compiling-languages">
<h2>Compiling languages<a class="headerlink" href="#compiling-languages" title="Permalink to this headline">¶</a></h2>
<p>If your language is available in the locale directory of chimere, you will just
need to get it compiled. This can be done with (here, <strong>fr</strong> stands for french.
Replace it with the appropriate language code):</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH/chimere/chimere/
django-admin compilemessages</pre>
</div>
<p>If your language is not available, feel free to create the default po file and
to submit it, contributions are well appreciated. Procedure is as follows:</p>
<p>You first need to create the default po file (of course, replace <strong>fr</strong>
according to the language you choose to create):</p>
<div class="highlight-python"><pre>django-admin makemessages -l fr</pre>
</div>
<p>There should now be a <em>django.po</em> file in <em>locale/fr/LC_MESSAGES</em>. Complete it
with your translation.</p>
<p>Now that the translation file is completed, just compile it the same way you
would have if the language file was already available.</p>
</div>
<div class="section" id="database-initialisation">
<h2>Database initialisation<a class="headerlink" href="#database-initialisation" title="Permalink to this headline">¶</a></h2>
<p>Create the appropriate tables (still being in chimère application directory):</p>
<div class="highlight-python"><pre>cd $INSTALL_PATH/chimere/mychimere_project
./manage.py syncdb</pre>
</div>
<p>You will be prompted for the creation of an administrator account
(administration can be found at: <a class="reference external" href="http://where_is_chimere/admin">http://where_is_chimere/admin</a>). Then you have
to create tables managed with south:</p>
<div class="highlight-python"><pre>./manage.py migrate</pre>
</div>
<p>The database is set, congratulations!</p>
<p>If you want to populate your installation with default data (don’t do this on
an already populated instance!):</p>
<div class="highlight-python"><pre>./manage.py loaddata ../chimere/fixtures/default_data.json</pre>
</div>
</div>
<div class="section" id="webserver-configuration">
<h2>Webserver configuration<a class="headerlink" href="#webserver-configuration" title="Permalink to this headline">¶</a></h2>
<div class="section" id="apache-configuration-with-mod-wsgi">
<h3>Apache configuration with mod_wsgi<a class="headerlink" href="#apache-configuration-with-mod-wsgi" title="Permalink to this headline">¶</a></h3>
<p>Install mod_wsgi for apache:</p>
<div class="highlight-python"><pre>apt-get install libapache2-mod-wsgi</pre>
</div>
<p>TODO: adapt apache-wsgi.conf</p>
<p>Create and edit a configuration for Chimère:</p>
<div class="highlight-python"><pre>cp $INSTALL_PATH/chimere/apache/django.wsgi $INSTALL_PATH/chimere/apache/mydjango.wsgi
vim $INSTALL_PATH/chimere/apache/mydjango.wsgi
cp $INSTALL_PATH/chimere/apache/apache-wsgi.conf /etc/apache2/sites-available/chimere
vim /etc/apache2/sites-available/chimere
# create log dir
mkdir /var/log/apache2/chimere/</pre>
</div>
<p>Adapt the files <em>mydjango.wsgi</em> (with the correct sys path) and Apache <em>chimere</em>.</p>
<p>To activate the website, reload apache:</p>
<div class="highlight-python"><pre>a2ensite chimere
/etc/init.d/apache2 reload</pre>
</div>
<p>If you encounter problem with the upload of files with Unicode chars in their
names, activate the appropriate locale in Apache. On a Debian server with UTF-8
as default encoding in the file <em>/etc/apache2/envvars</em>, uncomment the following
line:</p>
<div class="highlight-python"><pre>. /etc/default/locale</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Installation</a><ul>
<li><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
<li><a class="reference internal" href="#database-configuration">Database configuration</a></li>
<li><a class="reference internal" href="#install-the-sources">Install the sources</a><ul>
<li><a class="reference internal" href="#from-an-archive">From an archive</a></li>
<li><a class="reference internal" href="#from-the-git-repository">From the git repository</a></li>
</ul>
</li>
<li><a class="reference internal" href="#create-a-custom-project-template">Create a custom project template</a></li>
<li><a class="reference internal" href="#compiling-languages">Compiling languages</a></li>
<li><a class="reference internal" href="#database-initialisation">Database initialisation</a></li>
<li><a class="reference internal" href="#webserver-configuration">Webserver configuration</a><ul>
<li><a class="reference internal" href="#apache-configuration-with-mod-wsgi">Apache configuration with mod_wsgi</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">Welcome to Chimère’s documentation!</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="upgrade.html"
title="next chapter">Upgrade</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/install.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="upgrade.html" title="Upgrade"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to Chimère’s documentation!"
>previous</a> |</li>
<li><a href="index.html">Chimère v2.0 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2012, Étienne Loks.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div>
</body>
</html>
|