Web design with Django

A project using Django.

Since some time I have nearly completed another project, just waiting for completion. It was nothing too complicated, but I had to work with images and create a admin interface. I don’t really like working with images, because I always need a photo editing tool have to find out the correct file size, and save them to a specific path, or upload them to the web server. All this is quite some routine work, which requires no thinking, but quite some time, summing up the things that I don’t like to do. The same goes for the admin interface. It usually requires some simple PHP code but again takes quite some time, but not so much thinking, and the design won’t be seen by anyone else then the website owner. Therfore it just has to be functional, but not really important. For this project I wanted to try out Django, which after using Hyde for this site is my second web design project using python. It turned out much better then just trying out something.

Admin interface

Django makes it easier to build better Web apps more quickly and with less code”. That’s what they write on the projects frontpage. And it couldn’t be more true, especially for the admin interface. Just create your database layout which is really easy with Models. No SQL to remember, just some straight forward Python. What’s even easier is activating the admin site. Just uncomment a few lines, and you have user authentication and every formular needed to fill your database. That makes Django a great choice, if you need a small admin interface.


The other thing I discovered to be great with Django was the images. First I had a simple uploader with the ImageField, that comes standard with Django. This wasn’t completely satisfying, because it still required the user to resize the image before uploading, in order for them to have all the same size. And there were no thumbnails. But searching around the web I discovered the beautiful django-stdimage, or even better the fork django-stdimage2. This libraries let you automatically resize the images, with just one parameter in the database model and create the thumbnails (which didn’t work in django-stdimage, which is why I switched to the fork). Thanks to this library the usage of images got somewhat easy, which was well appreciated for this project with a lot of images.


A concern about using Django may be the compatibility with web hosts, since it needs Python to run. But nowadays every half decent hosting plan should include Python support. It may even work on Godaddy Deluxe Hosting, which really doesn’t have a lot of features (Don’t take my word for granted, it may also not work, because of the version of Python installed).


I have yet to try out Ruby on Rails and see if it has some similar features, but for projects similar to this Django might be the framework of my choice. Those two things mentioned here speed up the development a lot, and I probably have only scratched the surface of what Django can do, since this was my first experience with it.