From 2a39cffb511f43587d26a6463a129087d7655030 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 25 Oct 2011 15:07:43 +0200 Subject: Upgrade documentation --- docs/INSTALL.t2t | 153 ------------------------------------------------ docs/generate | 5 -- docs/source/index.rst | 3 +- docs/source/upgrade.rst | 130 ++++++++++++++++++++++++++++++++++++++++ docs/style.css | 67 --------------------- 5 files changed, 132 insertions(+), 226 deletions(-) delete mode 100644 docs/INSTALL.t2t delete mode 100755 docs/generate create mode 100644 docs/source/upgrade.rst delete mode 100644 docs/style.css diff --git a/docs/INSTALL.t2t b/docs/INSTALL.t2t deleted file mode 100644 index 019717e..0000000 --- a/docs/INSTALL.t2t +++ /dev/null @@ -1,153 +0,0 @@ -Chimère installation -Étienne Loks -Last update: %%date(%m-%d-%Y) - -+ Installation + - -++ Prerequisites ++ - -- [python http://www.python.org/] versions 2.5, 2.6 or 2.3, 2.4 with [pysqlite http://oss.itsystementwicklung.de/trac/pysqlite/] -- [django http://www.djangoproject.com/] version 1.0 -- [apache http://www.apache.org/] 2.x with [mod_python http://www.modpython.org/ 3.x] -- [gettext http://www.gnu.org/software/gettext/] - - -The simple way to obtain theses elements is to get package from your favourite linux distribution (i.e. packages python, python-django, python-markdown, gettext, apache2 and libapache2-mod-python in Debian Lenny). Otherwise refer to the sites of these applications. - -Optionnal requesite: - -- [tinymce http://tinymce.moxiecode.com/]: Javascript WYSIWYG Editor. If you want to use it don't forget to edit TINYMCE_URL in settings.py. - -+++ Getting the sources +++ - -The last "stable" version is available in this [directory http://www.peacefrogs.net/download/]. - -Another solution is to get the last subversion version (inside /var/local/django/papillon if you want to strictly follow this HOWTO): - -``` -svn co http://www.peacefrogs.net/svn/papillon/papillon/trunk/ . -``` - -++ Install the sources ++ - -If necessary unpack then move the sources in a directory readable to the apache user (www-data in Debian). - -``` -sudo mkdir /var/local/django -cd /var/local/django -sudo tar xvjf /home/etienne/papillon-last.tar.bz2 -cd /var/local/django/papillon -sudo chown -R etienne:www-data papillon -``` - -Copy settings.py.tpl to settings.py and modify settings.py by initializing at least the variables ROOT_PATH, SERVER_URL and EXTRA_URL depending on your configuration: - -``` -cd papillon -vim settings.py -#### -ROOT_PATH = '/var/local/django/papillon/papillon' # path to the installation of django code of Papillon -SERVER_URL = 'http://www.peacefrogs.net/' # site path -EXTRA_URL = 'papillon/' # extra_url path -BASE_SITE = SERVER_URL + EXTRA_URL -#### -``` - -If you want to use a database other than sqlite ([postgresql http://www.postgresql.org/] or [mysql http://www.mysql.com/]) configure your database and set by the various fields beginning with DATABASE. - -In the directory Papillon, put up a symbolic link to the basic styles django (change the path depending on your installation of django): - -``` -ln -s /usr/share/python-support/python-django/django/contrib/admin/media/ . -``` - -++ Database initialisation ++ - -In the directory Papillon simply: - -``` -./manage.py syncdb -``` - -Answer the questions to create an administrator (administration pages can be found at: http://where_is_papillon/admin) and the base is set. -If you use sqlite (default database) give the write rights on the database file to the apache user: - -``` -chmod g+w papillon.db -chmod g+w . -``` - -++ Compiling languages ++ - -If your language is available in the locale directory of Papillon, you will just need to get it compiled. Still being in the papillon 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. - -++ Apache configuration ++ - -Create and edit a configuration file for Papillon. - -``` -sudo vim /etc/apache2/sites-available/papillon -``` - -Insert Apache directives for your installation. - -``` -# part of the address after the root of your site - -# directory path to the father of the installation of Papillon -PythonPath "['/var/local/django/papillon/'] + sys.path" -SetHandler python-program -PythonHandler django.core.handlers.modpython -SetEnv DJANGO_SETTINGS_MODULE papillon.settings -# set it to on or off if in test or production environment -PythonDebug On -# put differents interpreter names if you deploy several Papillon -PythonInterpreter papillon - -``` - -Or if you want to use a virtual domain: - -``` - -ServerName papillon.youdomain.net -# directory path to the father of the installation of Papillon -PythonPath "['/var/local/django/papillon/'] + sys.path" -SetHandler python-program -PythonHandler django.core.handlers.modpython -SetEnv DJANGO_SETTINGS_MODULE papillon.settings -# set it to on or off if in test or production environment -PythonDebug On -# put differents interpreter names if you deploy several Papillon -PythonInterpreter papillion - -``` - -Active this site, reload Apache and now your Papillon "can fly". - -``` -sudo a2ensite papillon -sudo /etc/init.d/apache2 reload -``` - -++ Post-installation ++ - -To configure categories go to the administration interface at http://where_is_papillon/admin . - - diff --git a/docs/generate b/docs/generate deleted file mode 100755 index 936ba03..0000000 --- a/docs/generate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -txt2tags --encoding utf-8 --css-sugar --style style.css --toc -t xhtml -o INSTALL.html INSTALL.t2t -txt2tags --encoding utf-8 --toc -t txt -o INSTALL INSTALL.t2t -awk '{gsub("\t"," ");print}' INSTALL > ../INSTALL -rm INSTALL diff --git a/docs/source/index.rst b/docs/source/index.rst index 9be220e..2e69012 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,9 +9,10 @@ Welcome to Papillon's documentation! Contents: .. toctree:: - :maxdepth: 3 + :maxdepth: 2 install + upgrade Indices and tables ================== diff --git a/docs/source/upgrade.rst b/docs/source/upgrade.rst new file mode 100644 index 0000000..61c2c30 --- /dev/null +++ b/docs/source/upgrade.rst @@ -0,0 +1,130 @@ +.. -*- coding: utf-8 -*- + +======= +Upgrade +======= + +:Author: Étienne Loks +:Date: 2011-10-25 +:Copyright: CC-BY 3.0 + +This document presents the upgrade from one version of Papillon to another. +Instructions are given for Debian and bash but they are easy to adapt to other distribution and other shells. + +From version 0.2 (and prior) to 0.3 +----------------------------------- + +First of all copy the installation path, the config files and your database. +Then you'll be able to rollback if there is any problem. + +Disable your installation in Apache +*********************************** +:: + + $ sudo a2dissite papillon + $ sudo /etc/init.d/apache2 reload + +Upgrade sources +*************** + +Get the new sources. Extract the tarball (from the download `directory `_) or clone the git repository in a temporary directory:: + + $ cd /tmp/ + $ git clone git://www.peacefrogs.net/git/papillon + $ cd papillon + $ git tag -l # list tagged versions + $ git checkout v0.3.0 # checkout the desired version + +Copy updated files to your installation (be careful to put trailing slash):: + + $ PAPILLON_PATH=/var/local/django/papillon/ + $ rsync -raP /tmp/papillon/ $PAPILLON_PATH + +As the Git is now used you can remove (if any) Subversion directory in your new installation:: + + $ cd $PAPILLON_PATH + $ find . -name ".svn" -exec rm -rf {} \; + +New dependencies +**************** + +In order to simplify future database evolution `django-south `_ is now used. To install it on a debian Squeeze:: + + $ sudo aptitude install python-django-south + + +"settings.py" changes +********************* + +Many changes have to be made in settings.py. + +Change any occurence of ROOT_PATH to PROJECT_PATH:: + + $ cd $PAPILLON_PATH + $ sed -i 's/ROOT_PATH/PROJECT_PATH/g' papillon/settings.py + +Change the manualy set definition of the project path by the lines:: + + import os.path + PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) + +Migrate to new version of db configuration. The lines:: + + DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. + DATABASE_NAME = PROJECT_PATH + 'papillon.db' # Or path to database file if using sqlite3. + DATABASE_USER = '' # Not used with sqlite3. + DATABASE_PASSWORD = '' # Not used with sqlite3. + DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. + DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +Become:: + + DATABASES = { + 'default': { + 'ENGINE': 'sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': PROJECT_PATH + 'papillon.db', # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } + } + +Add (and adapt) the lines:: + + MAX_COMMENT_NB = 20 # max number of comments by poll - 0 to disable comments + ALLOW_FRONTPAGE_POLL = False # disabled is recommanded for public instance + +You can now remove SERVER_URL and BASE_SITE variables. +You have to change MEDIA_URL and ADMIN_MEDIA_PREFIX. If there is no EXTRA_URL and you want to keep it managed by Django, you have to change them to:: + + MEDIA_URL = '/static/' + ADMIN_MEDIA_PREFIX = '/media/' + +Otherwise set the full URL. + + +Update database +*************** +:: + + $ cd $PAPILLON_PATH + $ cd papillon + $ ./manage.py syncdb + $ ./manage.py migrate polls --fake + + +Regeneration of translations +**************************** +:: + + $ cd $PAPILLON_PATH + $ cd papillon + $ ./manage.py compilemessages -l fr + +Enable your new installation in Apache +************************************** +:: + + $ sudo a2ensite papillon + $ sudo /etc/init.d/apache2 reload diff --git a/docs/style.css b/docs/style.css deleted file mode 100644 index 5ba1a2f..0000000 --- a/docs/style.css +++ /dev/null @@ -1,67 +0,0 @@ -html{ -background-color:#dfcbff; -font-family:arial; -font-size:80%; -} - -body{ -padding:20px; -background-color:white; -} - -a{ -color:#b400ff; -} - -h1{ -font-size:22px; -margin-left:auto; -margin-right:auto; -margin-bottom:10px; -padding-left:20px; -color:white; -background-color:#b488ff; -} - -h2{ -font-size:18px; -padding-left:20px; -color:#b400ff; -} - -h3{ -padding-left:20px; -font-weight:normal; -font-style:italic; -color:#b400ff; -} - -pre{ -background-color:#dfcbff; -padding:10px 6px; -} - -table{ -border-spacing:0px; -border:1px solid; -border-right:None; -} - -td, th, tr{ -border:None; -margin:0; -padding:0; -border-spacing:0px; -border-right:1px solid; -} - -td{ -padding:4px 8px; -} - -th{ -background-color:#dfcbff; -padding:8px; -border-bottom:1px solid; -} - -- cgit v1.2.3