- Installation (Français)
- Prerequisites
- Database configuration
- Getting the sources
- Install the sources
- Compiling languages
- Database initialisation
- Apache configuration
Installation (Français)¶
Prerequisites¶
- apache version 2.x with mod_python 3.x
- python versions 2.4 or superior
- geodjango version 1.0
- postgres version 8.x
- gettext
- psycopg2
- Python Imaging Library
- Beautiful Soup
geodjango is a part of django version 1.0 but it has some specific (geographically related) additionnal dependencies:
Optionaly (but recommanded):
The simpliest way to obtain these packages is to get them from your favorite Linux distribution repositories (for instance python, python-django, tinymce, apache2, libapache2-mod-python, libgeos-3.0.0, proj, gdal-bin, python-psycopg2, python-imaging, postgresql-8.3 and postgresql-8.3-postgis packages for Debian Lenny). If these packages do not exist in your distribution's repository, please refer to the applications' websites.
Database configuration¶
Now that postgres and postgis are installed, you need to create a new user for chimere:
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):
createdb --echo --owner chimere-user --encoding UNICODE chimere "My Chimère database"
createlang plpgsql chimere
psql -d chimere -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
psql -d chimere -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
Getting the sources¶
The last "stable" version is available in this directory as a bzipped archive.
Another solution is to get a git version:
git clone git://www.peacefrogs.net/git/chimere
git tag -l # list tagged versions
git checkout v1.0.0 # checkout the desired version
Install the sources¶
Unpack and move the files in an apache user (www-data for Debian) readable directory
sudo mkdir /var/local/django
cd /var/local/django
sudo tar xvjf /home/etienne/chimere-last.tar.bz2
sudo chown -R etienne:www-data chimere
In your chimere application directory modify settings.py to fit to your configuration:
cd chimere/chimere/
vim settings.py
####
PROJECT_NAME = u'Chimère'
ROOT_PATH = '/var/local/django/chimere/chimere/' # path to the installation of Chimère
SERVER_URL = "http://www.peacefrogs.net/" # root of the web address of Chimère
EXTRA_URL = 'chimere/' # suffix to the web address of Chimère
BASE_URL = SERVER_URL + EXTRA_URL
EMAIL_HOST = 'localhost' # smtp of an email server to send emails
TINYMCE_URL = SERVER_URL + 'tinymce/'
# chimere specific
DEFAULT_CENTER = (-1.679444, 48.114722) # default center of the map
EPSG_PROJECTION = 900913 # projection used for data exchange (JSON flow)
EPSG_DISPLAY_PROJECTION = 4326 # projection used to display on the map
# default id category to check on the map
DEFAULT_CATEGORIES = [1] # list of default category ids checked on the map
# JS definition of the main map cf. OpenLayers documentation for more details
# to begin you can leave the default OpenStreetMap map rendered with Mapnik
MAP_LAYER = "new OpenLayers.Layer.OSM.Mapnik('Mapnik')"
# setting the appropriate language code for your site
LANGUAGE_CODE = 'en-gb'
# database configuration
DATABASE_ENGINE = 'postgresql_psycopg2' # leave it to 'postgresql_psycopg2'
DATABASE_NAME = 'chimere' # database name
DATABASE_USER = 'chimere-user' # database user
DATABASE_PASSWORD = 'mypassword' # database password
DATABASE_HOST = '' # set to empty string for localhost
DATABASE_PORT = '' # set to empty string for default
####
If you want to use tinymce don't forget to make it available to Chimère.
In this same chimere directory, make a symbolic link to django's basic styles (do not forget to change the path according to your configuration, it is the last time I will recall it to you. Next time, you are on your own !):
ln -s /usr/share/pyshared/django/contrib/admin/media/ .
Compiling languages¶
If your language is available in the locale directory of chimere, you will just need to get it compiled. Still being in the chimere directory, this can be done with (here, "de" stands for german. Replace it with the appropriate language code) :
django-admin compilemessages -l de
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 "de" according to the language you chose to create) :
django-admin makemessages -l de
There should now be a django.po file in locale/de/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.
Database initialisation¶
Create the appropriate tables (still being in chimère application directory):
./manage.py syncdb
You will be prompted for the creation of an administrator account (administration can be found at: http://where_is_chimere/admin).
The database is set, congratulations!
Apache configuration¶
Create and edit a configuration file for Chimère.
sudo vim /etc/apache2/sites-available/chimere
Insert Apache directives for your installation.
# part of the address after the root of your site
<Location "/chimere/">
# directory path to the father of the installation of Chimère
PythonPath "['/var/local/django/'] + sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE chimere.settings
# set it to on or off if in test or production environment
PythonDebug On
# put differents interpreter names if you deploy several Chimère
PythonInterpreter chimere
</Location>
To activate the website reload apache.
sudo a2ensite chimere
sudo /etc/init.d/apache2 reload
Now that you have gone through ALL this configuration procedure (which was not that hard after all) you can [[Configuration|configure the site]].