Case Study

In part 1 we defined our limits and the requirements needed to replace PHP. We gave Python a first look and found out it is quite easy to use it in Apache. To get a good feeling of what Python can do and how to build a Real World site, I decided to use our Beers website as a case study. It is a simple website where we post beers we tasted around the world, including photos and reviews. It works with a simple database and administration possibilities.  The goal is to re-implement the site in Python and transfer all existing data into it.

Django

Researching Python and web applications quickly puts you on the road of web application frameworks, something I really haven’t used in PHP. Maybe that’s one of the reason of all my bad PHP habits. The de facto Python framework standard seems to be Django. And a nice warm bath it is. It installs like a breeze (as simple as an apt-get install python-django) and has great documentation. I am on part three of its good tutorial now and I am getting a feeling of the joy of using both Python and the Django framework. There are a few things to consider though:

  • You cannot just start churning out code and design along the way like you can in PHP. This is of course a Good Thing, but can be a little of a turnoff if you want to just quickly hack something together.
  • A lot of stuff is happening “under the hood” and in the library. I still have to get a good feeling how it all fits together.

I have used CakePHP before as a framework in PHP, but it didn’t give me the same feeling as Django does. This can of course be because of me. But after running through the tutorial and trying to wrap my head around its workings, Django makes me want to continue with it, CakePHP made me want to put it away. Django gives me the feeling I am still in control, because it hides all the standard stuff behind (highly customisable) admin pages. The actual web application has to be written completely by you. Django includes full MVC support (database connections are seamless, no need to write any SQL) and a template system. Using the manage.py shell you can even load and edit the data in real time. In short, Python with Django lets you create apps, not write the same stuff over and over again. It is not really about the language yet, I hope I can get to that in the next part.

Categorieën: GeekstuffOpinie

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze website gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.