From aae0f5143ea6bb40459a4bc5a5b738d7852a6ea3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 15 Jun 2013 12:45:25 +0200 Subject: Upgrade source code to work with Django 1.4 * cleaner way to manage settings.py * fix feeds for Django 1. * fix settinsg for Django 1.4 * update documentation --- docs/source/install.rst | 99 +++++++++++++++---------------- docs/source/upgrade.rst | 78 ++++++++++++++++--------- papillon/local_settings.py.sample | 38 ++++++++++++ papillon/polls/feeds.py | 14 +++-- papillon/settings.py | 120 ++++++++++++++++++++++++++++++++++++++ papillon/settings.py.tpl | 118 ------------------------------------- papillon/templates/base.html | 2 +- papillon/urls.py | 9 +-- 8 files changed, 271 insertions(+), 207 deletions(-) create mode 100644 papillon/local_settings.py.sample create mode 100644 papillon/settings.py delete mode 100644 papillon/settings.py.tpl diff --git a/docs/source/install.rst b/docs/source/install.rst index 1defe38..a48bb35 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -22,7 +22,7 @@ Requirements - `python-markdown `_ - - `django `_ version 1.2 + - `django `_ version 1.4 - `django-south `_ version 0.7 @@ -32,7 +32,7 @@ Requirements The simple way to obtain theses elements is to get package from your favourite linux distribution. -For instance the packages for Debian squeeze are get with:: +For instance the packages for Debian wheezy are get with:: $ sudo apt-get install python python-django python-django-south $ sudo apt-get install python-markdown gettext apache2 @@ -47,7 +47,7 @@ Choose an install path First of all you have to choose an install path:: - $ INSTALL_PATH=/var/local/django/ + INSTALL_PATH=/var/local/django/ Of course you have to create it if it doesn't exist. @@ -58,31 +58,32 @@ The last "stable" version is available in this `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 + cd /tmp/ + git clone git://www.peacefrogs.net/git/papillon + cd papillon + git tag -l # list tagged versions + git checkout v0.4.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 + 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 {} \; + cd $PAPILLON_PATH + sudo find . -name ".svn" -exec rm -rf {} \; + +From version 0.3 to 0.4 +----------------------- + +New dependencies +**************** + +Papillon needs now at least Django version 1.4. Upgrade your version of Django. + +New settings management +*********************** + +Settings are not managed the same way. To manage properly the upgrade follow +theses steps (in the project directory): + +* Copy local_settings.py.sample to local_settings.py. +* Report your old configuration to local_settings.py (put only the fields that + defers from the new settings.py). +* Be careful: database engines have changed (the sample give you the new path to + sqlite engine). + +From version 0.2 (and prior) to 0.3 +----------------------------------- 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 + sudo aptitude install python-django-south "settings.py" changes @@ -58,12 +81,12 @@ In order to simplify future database evolution `django-south diff --git a/papillon/urls.py b/papillon/urls.py index 862f66a..e0e9ed6 100644 --- a/papillon/urls.py +++ b/papillon/urls.py @@ -25,10 +25,6 @@ admin.autodiscover() from polls.feeds import PollLatestEntries -feeds = { - 'poll': PollLatestEntries, -} - base = '^' + settings.EXTRA_URL if settings.EXTRA_URL and not base.endswith('/'): base += '/' @@ -37,7 +33,7 @@ urlpatterns = patterns('', (base + r'admin/doc/', include('django.contrib.admindocs.urls')), url(base + r'admin/jsi18n/$', 'django.views.i18n.javascript_catalog', name='admin_i18n'), - (base + r'admin/(.*)', admin.site.root), + url(base + r'^admin/', include(admin.site.urls)), url(base + r'$', 'papillon.polls.views.index', name='index'), url(base + r'create/$', 'papillon.polls.views.create', name='create'), url(base + r'edit/(?P\w+)/$', @@ -52,8 +48,7 @@ urlpatterns = patterns('', name='poll'), url(base + r'poll/(?P\w+)/vote/$', 'papillon.polls.views.poll', name='vote'), - url(base + r'feeds/(?P.*)$', 'django.contrib.syndication.views.feed', - {'feed_dict': feeds}, name='feed'), + url(base + r'feeds/poll/(?P\w+)$', PollLatestEntries(), name='feed'), (base + r'static/(?P.*)$', 'django.views.static.serve', {'document_root': settings.PROJECT_PATH + '/static'}), (base + r'media/(?P.*)$', 'django.views.static.serve', -- cgit v1.2.3