summaryrefslogtreecommitdiff
path: root/docs/source/upgrade.rst
blob: 24f7d4440595cae9e4a066bbce99fe18d1c0144b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
.. -*- 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 <http://www.peacefrogs.net/download/>`_) 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/
    $ sudo 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
    $ sudo find . -name ".svn" -exec rm -rf {} \;

New dependencies
****************

In order to simplify future database evolution `django-south <http://south.aeracode.org/>`_ 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__))

Be careful: PROJECT_PATH has no trailing slash. So for every variable
using PROJECT_PATH don't forget (if necessary) to add a slash.

For instance if you have::

    TEMPLATE_DIRS = (
        PROJECT_PATH + 'templates',
    )

Change it to::

    TEMPLATE_DIRS = (
        PROJECT_PATH + '/templates',
    )

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.

Add South to the list of installed applications (before papillon.polls)::

    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.markup',
    'south',
    'papillon.polls',
    )


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