Monday, March 10, 2014

Update Django on Webfaction

We are using webfaction for our Django Application, and its been really awesome service for the Django apps. Most of the things are configurable from their support dashboard.

Now you get to choose the Django and python version when you setup your application first time. However, later if you want to upgrade to newer version of the Django as it made available by Django community, you can follow below steps. In this example my current version of Django is 1.4.1 and I am going for Django 1.4.5.

Please note, following steps are just to update the Django version, if there are functional, API, Model query, settings or any other changes required inside your application, you will need to refer to Django official documentation or migration guide provided on the Django.

Here are the steps to upgrade Django in Webfaction -

1. Go to your App directory. 
> $HOME/webapps/

2. Get the version you want. (here we are extracting 1.4.5)
> wget

3. Extract.
> tar -zxvf Django-1.4.5.tar.gz

4. Rename the existing one. (existing django to django.old)
> mv lib/python2.7/django lib/python2.7/django.old

5. move the new one to lib (now as we have renamed, we can move the content from new django package to lib/python 2.7)
> cp -R Django-1.4.5/django lib/python2.7

6. move the management scripts (copy management script for wsgi, and app creation etc.)
> cp Django-1.4.5/django/bin/* bin
7. Restart and make sure it runs fine.
> apache2/bin/restart

8. delete the extract and tar (only after checking that it works fine, you can remove the floating folder and file from the directory.)
> rm -rf Django-1.4.5*

And that should do the trick! Feel free to drop message or email if you run into any issue.


No comments:

Post a Comment