.. -*- coding: utf-8 -*- ==================== Chimère installation ==================== :Author: Étienne Loks :date: 2012-03-09 :Copyright: CC-BY 3.0 This documents presents the installation of Chimère. ----------------- Base installation ----------------- Installation ------------ Prerequisites ************* - `apache `_ version 2.x - `python `_ versions 2.6 or 2.7 - `django `_ version 1.3 - `south `_ - `postgres `_ version 8.x - `gettext `_ - `psycopg2 `_ - `Python Imaging Library `_ - `Beautiful Soup `_ - `lxml `_ - `jquery `_ version 1.7.1 or better - `jquery-ui `_ geodjango is a part of django since version 1.0 but it has some specific (geographically related) additional dependencies: - `geos `_ 3.0.x - `proj.4 `_ 4.4 to 4.6 - `posgis `_ versions 1.2.1 or 1.3.x - `gdal `_ Optionaly (but recommanded): - `tinymce `_ - `gpsbabel `_ 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.1 proj gdal-bin \ python-gdal python-lxml python-psycopg2 python-imaging gettext \ postgresql-9.1 postgresql-9.1-postgis libjs-jquery libjs-jquery-ui 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:: 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):: createdb --echo --owner chimere-user --encoding UNICODE chimere "My Chimère database" createlang plpgsql chimere psql -d chimere -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql psql -d chimere -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql Install the sources ******************* Choose a path to install your Chimère:: sudo mkdir /var/local/django INSTALL_PATH=/var/local/django From an archive +++++++++++++++ The last "stable" version is available in this `directory `_. Download, unpack and move the files in an apache user (www-data for Debian) readable directory:: cd $INSTALL_PATH sudo tar xvjf /home/etienne/chimere-last.tar.bz2 sudo chown -R myusername:www-data chimere From the git repository +++++++++++++++++++++++ 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.0 # checkout the desired version Base configuration ****************** There a default project provided "example_project". Copy and modify it (or get another project based on Chimere):: cd $INSTALL_PATH/chimere cp -r example_project mychimere_project In your chimere application directory create settings.py to fit to your configuration. A base template is provided (settings.py.example) and short descriptions of the more relevant fields are given below (at least check them):: cd $INSTALL_PATH/chimere/mychimere_project cp settings.py.example settings.py vim settings.py :Fields: * PROJECT_NAME: name of the project * ROOT_PATH: path to the installation of Chimère * SERVER_URL: root of the web address of Chimère * EXTRA_URL: suffix to the web address of Chimère * EMAIL_HOST: smtp of an email server to send emails * TINYMCE_URL: url to tinymce path (default is appropriate for a Debian installation with tinymce activated) * JQUERY_JS_URLS: list of Jquery and Jquery-ui urls (default is appropriate for a Debian installation with Jquery and Jquery-ui activated) * JQUERY_CSS_URLS: list of Jquery and Jquery-ui urls (default is appropriate for a Debian installation with Jquery and Jquery-ui activated) * GPSBABEL: path to gpsbabel (default is appropriate for a Debian installation with gpsbabel installed) * CHIMERE_DEFAULT_ZOOM: default zoom on map * CHIMERE_DEFAULT_CENTER: center of the map * CHIMERE_DYNAMIC_CATEGORIES: dynamic load of categories on the main map * CHIMERE_DISPLAY_AREAS: display area's shortcuts * DATABASES: parameters for the database * TIME_ZONE: local time zone for this installation * LANGUAGE_CODE: language code for this installation * ROOT_URLCONF: url configuration for your project something like: 'mychimere_project.urls' Manage media path permission:: cd $INSTALL_PATH/chimere/mychimere_project sudo chown -R user:www-data media sudo chmod -R g+w media Regroup static files in one path:: cd $INSTALL_PATH/chimere/mychimere_project ./manage.py collectstatic Compiling languages ******************* 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/mychimere_project ./manage.py compilemessages -l fr 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):: ./manage.py 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. Database initialisation *********************** 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! Webserver configuration *********************** Apache configuration with mod_wsgi ++++++++++++++++++++++++++++++++++ Install mod_wsgi for apache:: sudo apt-get install libapache2-mod-wsgi Create and edit a configuration for Chimère:: sudo vim $INSTALL_PATH/chimere/apache/django.wsgi sudo vim $INSTALL_PATH/chimere/apache/apache-wsgi.conf sudo cp $INSTALL_PATH/chimere/apache/apache-wsgi.conf /etc/apache2/sites-available/chimere Adapt the files django.wsgi (with the correct sys path) and chimere. To activate the website reload apache:: sudo a2ensite chimere sudo /etc/init.d/apache2 reload ------------------ Base configuration ------------------ When you have installed the application there is a few simple steps to follow to configure *your* Chimère. Most of theses steps are done in the administration pages accessible at : http://where_is_chimere/admin To access theses pages you have to identify you with login and password provided at the initialization of the database. Creating users -------------- If you are not the only administrator of this Chimère installation you have to create account for the other users. Currently the process has to be done manualy. Simply click on the Add button near Users. Give a name and a default password (the user can change it on in own later). Then complete the other pieces of information. Check the case: Member of the staff (or this user will not be able to log to this administration site). To simply give this user correct rights don't add permission manualy but make this user member of a group. Two default group are proposed: application administrator and moderator. Detail of rights for default user/groups: +-----------------------------------------+-------------------+---------------------------+-----------+ | Task | Application owner | Application administrator | Moderator | +=========================================+===================+===========================+===========+ | User add/modify/delete | yes | no | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | Group add/modify/delete | yes | no | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | Property model add/modify/delete | yes | no | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | News add/modify/delete | yes | yes | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | Area add/modify/delete | yes | yes | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | Icon add/modify/delete | yes | yes | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | Category/Subcategory add/modify/delete | yes | yes | no | +-----------------------------------------+-------------------+---------------------------+-----------+ | Point Of Interest add/modify/delete | yes | yes | yes | +-----------------------------------------+-------------------+---------------------------+-----------+ | Route add/modify/delete | yes | yes | yes | +-----------------------------------------+-------------------+---------------------------+-----------+ Setting the welcome page ------------------------ The message has to be set by updating the file templates/welcome.html. You only have to change the message at the begin of #detail_content. Creating property models ------------------------ A basic installation of Chimère only permit to associate a name, a category and (for the point of interest) a picture for each point of interest and each route. You may want to add more fields like phone number or opening hours. For that all you have to do is to add a new property model. The administration ask you for name, order (to order between other properties), availability for the user and type (only text field and long text field are available for the moment). Then to make this property available it is necessary to restart your application (and then probably to reload Apache). All forms are then automaticaly updated with this new field. Updating the detail window -------------------------- When clicking on a POI a window appear with the details. Particulary if you have set some new property models you may want to customize this window. Each property is in a paragraph with id: property_i_j (i is the order and j is the model property id - the first model property is id 1 then 2...). You can simply adapt the CSS file (static/styles.css) to match the desired presentation. If you want to really change the whole presentation you can change the template file templates/detail.html (go to the Django template documentation for details). Updating the design ------------------- You can of course customize Chimère with your own CSS. To do that just edit the file static/styles.css. After this basic configuration done the harder is done. You can do now application administration tasks. ------------------- Site administration ------------------- The explanation are to create new elements. To modify these elements it is the same if only some fields are already filled. Creating news ------------- A news system is available. All you have to to do is to click on the Add button near News. For each news you have to provided a name and a content. The content can contain HTML tags. The avaibility is set with a checkbox. Creating categories/subcategories --------------------------------- Before adding categories you have to set some icons. Theses icons appears on the map and in the categories' box on the main map. Be careful to resize correctly your icons. Indeed the icon will be presented at their real size on the map. To add icons: the Add button near Icons. Categories are in fact only containers for subcategories. You'll have to provide only a name and an order. To add categories: the Add button near categories (quite clear now, isn't it?) Fields of subcategories are: an associated category, a name, an icon, an order, a color and an element type. Theses fields are mainly quite self-explainatory. The color is used to draw routes (if this subcategory contains routes). If it a basic color it can be set with the english name (for instance: "red", "blue", "yellow" or "purple") otherwise you can put the HTML RVB code (for instance "#9227c9"). The element type is the type of element the subcategory can contain: POI, route or both. Creating areas -------------- Areas are useful to provide a quick access to a particular town, a district, etc. To define an area fill a name and move/zoom to the choosed location. Submit it and that's all. ---------- Moderation ---------- The moderation step is quite simple. It works the same with POIs and routes. The moderator can access to all POIs (or routes) by clicking on the Modify button. A search field is available to search by name but the more interesting is to filter POIs (or route) by state and by subcategory. Then to modify an item you have to click on his name. The submission can now freely modified. Compared to the main submission interface there is only on field add: the state field. To be publish in the main site the item must have the state: Available. If an item is not revelant the Delete button permit to remove it.