| Author: | Étienne Loks |
|---|---|
| date: | 2012-10-08 |
| Copyright: | CC-BY 3.0 |
This documents presents the installation of Chimère. The version has been updated for version 2.0.0.
- apache version 2.x
- python versions 2.6 or 2.7
- django >= version 1.4
- south
- postgres >= version 8.x
- gettext
- psycopg2
- Python Imaging Library
- pyexiv2
- Beautiful Soup
- python-simplejson
- python-gdal
- `unidecode <http://pypi.python.org/pypi/Unidecode>_
- lxml
- jquery version 1.7.1 or better
- jquery-ui
- Universal Feed Parser
geodjango is a part of django since version 1.0 but it has some specific (geographically related) additional dependencies:
Optionaly (but recommanded):
The simpliest way to obtain these packages is to get them from your favorite Linux distribution repositories. For instance on Debian Wheezy:
apt-get install python python-django python-django-south \
python-beautifulsoup tinymce apache2 libgeos-3.3.3 proj-bin gdal-bin \
python-gdal python-lxml python-psycopg2 python-imaging gettext \
postgresql-9.1 postgresql-9.1-postgis libjs-jquery libjs-jquery-ui \
python-django-celery python-simplejson gpsbabel \
python-pyexiv2 python-feedparser javascript-common
On Debian Squeeze (you need to activate backports):
apt-get install -t squeeze-backports python-django
apt-get install python python-django-south python-beautifulsoup tinymce \
apache2 libgeos-3.2.0 proj-bin gdal-bin python-gdal python-lxml \
python-psycopg2 python-imaging gettext postgresql-8.4 \
postgresql-8.4-postgis libjs-jquery libjs-jquery-ui python-simplejson \
gpsbabel python-pyexiv2 python-feedparser javascript-common
If these packages do not exist in your distribution’s repository, please refer to the applications’ websites.
Now that postgres and postgis are installed, you need to create a new user for chimere:
su postgres
createuser --echo --adduser --createdb --encrypted --pwprompt chimere-user
Then, you have to create the database and initialize the geographic types (adapt the paths accordingly to your needs):
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
Choose a path to install your Chimère:
INSTALL_PATH=/var/local/django
mkdir $INSTALL_PATH
The last “stable” version is available in this directory. 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:
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
Download, unpack and move the files in an apache user (www-data for Debian) readable directory:
cd $INSTALL_PATH
tar xvjf chimere-last.tar.bz2
chown -R myusername:www-data chimere
Another solution is to get the last git version:
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
There a default project provided “example_project”. Copy and modify it (or get another project based on Chimere):
cd $INSTALL_PATH/chimere
cp -ra example_project mychimere_project
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 “_” to any length. Don’t begin the name by “_” because it has special significance in Python.
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 theses settings are initialized in settings.py.
cd $INSTALL_PATH/chimere/mychimere_project
cp local_settings.py.sample local_settings.py
vim local_settings.py
| Fields: |
|
|---|
Manage media path permission:
cd $INSTALL_PATH/chimere/mychimere_project
chown -R user:www-data media
chmod -R g+w media
Create log file:
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/
Regroup static files in one path:
cd $INSTALL_PATH/chimere/mychimere_project
./manage.py collectstatic
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, fr stands for french). Replace it with the appropriate language code):
cd $INSTALL_PATH/chimere/chimere/
django-admin compilemessages
If your language is not available, feel free to create the default po files and to submit it, contributions are well appreciated. Procedure is as follows:
You first need to create the default po file (of course, replace fr according to the language you choose to create):
django-admin makemessages -l fr
There should now be a django.po file in locale/fr/LC_MESSAGES. Complete it with your translation.
Now that the translation file is completed, just compile it the same way you would have if the language file was already available.
Create the appropriate tables (still being in chimère application directory):
cd $INSTALL_PATH/chimere/mychimere_project
./manage.py syncdb
You will be prompted for the creation of an administrator account (administration can be found at: http://where_is_chimere/admin). Then you have to create tables managed with south:
./manage.py migrate
The database is set, congratulations!
If you want to populate your installation with default data (don’t do this on an already populated instance!):
./manage.py loaddata ../chimere/fixtures/default_data.json
Install mod_wsgi for apache:
apt-get install libapache2-mod-wsgi
TODO: adapt apache-wsgi.conf Create and edit a configuration for Chimère:
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/
Adapt the files mydjango.wsgi (with the correct sys path) and Apache chimere.
To activate the website reload apache:
a2ensite chimere
/etc/init.d/apache2 reload