Cette documentation n'est plus à jour. Elle concerne les anciennes version de Chimère.
Cette page décrit l'installation du logiciel Chimère sur une Debian Squeeze.
Il faut commencer par installer les paquets nécessaires au fonctionnement de l'application, notamment :
sudo apt-get install git tinymce apache2 libgeos-3.2.0 proj \ gdal-bin python-gdal python-lxml python-psycopg2 \ python-imaging gettext postgresql-8.4 \ postgresql-8.4-postgis libjs-jquery libjs-jquery-ui
# création de l'utilisateur de la base sudo -u postgres createuser --echo --adduser --createdb --encrypted --pwprompt chimere # création de la base sudo -u postgres createdb --echo --owner chimere --encoding UNICODE chimeredb "Chimère" # installation du langage procédurale plpgsql dans la base sudo -u postgres createlang plpgsql chimere # ajout des extensions géographiques psql -d chimeredb -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql psql -d chimeredb -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
Les sources seront installées dans $HOME/local/src
. Les données du serveurs web dans $HOME/www/cartes
# pour debuger django sudo mkdir /var/log/django sudo chgrp www-data -R /var/log/django/ sudo chmod g+w -R /var/log/django/ # téléchargrement des sources avec git cd $HOME/local/src git clone git://www.peacefrogs.net/git/chimere cd chimere # copie du code opérationnel cp -r example_project/ ~/www/carte
Toutes les dépendances nécessaires au fonctionnement de Chimère vont être installés dans un répertoire spécifique $HOME/python-environments
.
sudo apt-get install python-virtualenv python-pip libxml2-dev libxslt-dev libpq-dev libgdal-dev python-dev mkdir $HOME/python-environments cd $HOME/python-environments virtualenv --no-site-packages --distribute chimere pip install -E chimere -r $HOME/local/src/chimere/requirements.txt
cd ~/www/carte cp settings.py.example settings.py diff -u settings.py.example settings.py
--- settings.py.orig 2012-05-12 17:16:06.000000000 +0200 +++ settings.py 2012-06-22 21:55:49.000000000 +0200 @@ -9,11 +9,11 @@ TEMPLATE_DEBUG = DEBUG # Django settings for chimere project. -PROJECT_NAME = u'Chimère' +PROJECT_NAME = u'La carte' ROOT_PATH = os.path.realpath(os.path.dirname(__file__)) + "/" -SERVER_URL = 'http://www.mydomain.com/' -EXTRA_URL = 'chimere/' +SERVER_URL = 'http://carte.mondomaine.net' +EXTRA_URL = '' BASE_URL = SERVER_URL + EXTRA_URL EMAIL_HOST = 'localhost' STATIC_URL = '/' + EXTRA_URL + 'static/' @@ -23,7 +23,7 @@ JQUERY_JS_URLS = ('/javascript/jquery/jquery.js', '/javascript/jquery-ui/jquery-ui.js',) JQUERY_CSS_URLS = ('/javascript/jquery-ui/css/smoothness/jquery-ui.css', - '/javascript/jquery-ui-themes/base/jquery.ui.all.css') + '/javascript/jquery-ui/themes/base/jquery.ui.all.css') OSM_CSS_URLS = ["http://www.openlayers.org/api/theme/default/style.css"] OSM_JS_URLS = [STATIC_URL + "chimere/js/OpenLayers.js", @@ -35,9 +35,9 @@ #GPSBABEL_OPTIONS = 'simplify,count=100' ## chimere specific ## -CHIMERE_DEFAULT_ZOOM = 10 +CHIMERE_DEFAULT_ZOOM = 14 # center of the map -CHIMERE_DEFAULT_CENTER = (-1.679444, 48.114722) +CHIMERE_DEFAULT_CENTER = (-1.5917, 48.0467,) # projection used by the main map # most public map providers use spherical mercator : 900913 CHIMERE_EPSG_PROJECTION = 900913 @@ -54,6 +54,8 @@ # don't forget to run the upgrade.py script to create appropriate fields in # the database CHIMERE_DAYS_BEFORE_EVENT = 30 +# allow feeds +CHIMERE_FEEDS = False CHIMERE_ICON_WIDTH = 21 CHIMERE_ICON_HEIGHT = 25 @@ -77,19 +79,19 @@ CHIMERE_SHAPEFILE_ENCODING = 'ISO-8859-1' ADMINS = ( - # ('Your Name', 'your_email@domain.com'), + ('Bob Alice', 'bob@mondomaine.net'), ) MANAGERS = ADMINS DATABASES = { 'default': { - 'NAME': 'ratatouille', + 'NAME': 'chimere', 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'HOST': 'localhost', 'PORT': '5432', - 'USER': 'ratatouille', - 'PASSWORD': 'wiki', + 'USER': 'chimere', + 'PASSWORD': 'Lemot2passeAchanger', }, } @@ -132,7 +134,7 @@ ADMIN_MEDIA_PREFIX += EXTRA_URL + '/admin-media/' # Make this unique, and don't share it with anybody. -SECRET_KEY = 'achanger_!ToChange!' +SECRET_KEY = 'UneJolieClefDe50caractèresàgénérer' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( @@ -149,7 +151,7 @@ 'django.contrib.messages.middleware.MessageMiddleware' ) -ROOT_URLCONF = 'example_project.urls' +ROOT_URLCONF = 'urls' TEMPLATE_DIRS = [ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
On configure Chimère pour utiliser le français.
cd ~/www/carte ~/python-environments/chimere/bin/python manage.py compilemessages -l fr
Quelques fichiers statiques sont nécessaires au fonctionnement de Chimère.
chgrp -R www-data ~/www/carte chmod g+w ~/www/carte/media cd ~/www/carte ~/python-environments/chimere/bin/python manage.py collectstatic
cd ~/www/carte ~/python-environments/chimere/bin/python manage.py syncdb # (création de l'administrateur admin) ~/python-environments/chimere/bin/python manage.py migrate
Python est lancé par Apache en mode WSGI.
Contenu du fichier ~/local/bin/chimere.wsgi
import os, sys import site prev_sys_path = list(sys.path) site.addsitedir('/home/sylvain/python-environments/chimere/lib/python2.6/site-packages') # Reorder sys.path so new directories at the front. new_sys_path = [] for item in list(sys.path): if item not in prev_sys_path: new_sys_path.append(item) sys.path.remove(item) sys.path[:0] = new_sys_path sys.path.append('/home/sylvain/www/carte/') os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler
Configuration du vhost apache /etc/apache2/sites-enabled/carte.mondomaine.net
<VirtualHost *:80> ServerName carte.mondomaine.net WSGIDaemonProcess carte processes=2 maximum-requests=500 threads=1 WSGIProcessGroup carte WSGIScriptAlias / /home/sylvain/local/bin/chimere.wsgi Alias /static "/home/sylvain/www/carte/static" Alias /media "/home/sylvain/www/carte/media" Alias /admin-media "/home/sylvain/python-environments/chimere/lib/python2.6/site-packages/django/contrib/admin/media/" Alias /tinymce "/usr/share/tinymce/www" <Directory "/usr/share/tinymce/www/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/carte.mondomaine.net_error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/carte.mondomaine.net_access.log combined </VirtualHost>
Il est possible de modifier l'aspect de Chimère. Pour cela, il faut écrire de nouvelles templates pour django.
— 02/06/2012 – Étienne Loks - Sylvain Collilieux – Ce texte est sous licence CC0