Upgrading your project to Django 1.5

Yeah, that's right! Django 1.5 has been released a couple days ago with some new brilliant features. 

You can read the release annoucement of James Bennett by follow this link: https://www.djangoproject.com/weblog/2013/feb/26/15/.

As usual, when upgrading to a new version of a platform, we should read the release notes carefully. And that is all you need: https://docs.djangoproject.com/en/1.5/releases/1.5/ .

The following is my notes when upgrading my Django project to the new version of the platform:

1. You have to get familiar with the concept of class-based view which was been introduced from version 1.3, if you work with django before the release of v1.3. I mention this because Django removes the generic view module which is function-based and add class-based module. Fuction-based view is the one that we usually use when defining a view in Django. It basically is you will create a class for a view instead of a function. Here are some instructions to migrate function-based generic view to class-based: https://docs.djangoproject.com/en/1.4/topics/generic-views-migration/ .

For more understanding about class-based view, please read the documentation: https://docs.djangoproject.com/en/1.5/ref/class-based-views/

2. Use built-in json module of python instead of django.utils.simplejson.

3. If you set DEBUG=False (usually in production environment) in settings.py, add the following setting or Django cannot trust and find your media files:

ALLOWED_HOSTS = ['localhost', 'example.com']
4. In your template, when including url to a view, remember to quote the view name:
{% url 'my_view' %}
Enjoy the cool new features of Django!

Comments