September 11, 2012

Django and Python 3

Many people use the Django Web Framework for turning their Web Project ideas into production websites. I did that myself a while ago, because it not only saves a lot of time - but I also like it because I can write the backend directly in Python code. Django is getting more and more attention and it has a large user base.

People which are new to Python have to decide first whether they want to use Python 2.x or 3.x for their projects. While on the one hand its better to go straight with 3.x because its actively developed and offers a lot of cool new features, many people are forced to use 2.x as many important Libraries have not been ported to Python 3.x yet on the other. This includes Django as well as the Twisted networking Library. All these projects have one in common: They are maintained for several years now and they have got a large user base. Turning 2.x code into code that runs on 3.x is a long term process which may take several months to years for projects of that size. Porting the code is definitely required: Python 2.x is not developed anymore. Python 2.7  is the latest release of the 2.x branch and is only updated with bug fixes and security patches. That's why some Linux distributions, such as Ubuntu, have decided to port all their tools to use Python 3 in the future.

However, Django is on a good way. The upcoming 1.5 release will support experimental Python 3 support using the six compability layer. The other day I cloned the development code of Django on Github and tried it to run with Python 3.2.3, which worked like a charm. I have not tested everything yet, but at least it feels to be faster. The Django development team encourages everyone to test whether their Django projects work with a latest version of Django's development snapshot and help to fix issues that are found by doing so.

I would recommend to start using the development snapshot along with Python 3 for new (large-scale) projects, because it will save you a lot of time if you have to port the code later.

The final release of Django 1.5 is scheduled for 24th of December 2012 (or even a few days before). Its release schedule was posted today in the django-developers mailing list.

Useful resources:

No comments:

Post a Comment