So a project using the Django framework that has to be completed in 48 hours. I was and still am new to Django, still wanted to take part to get deeper into the development of we applications using this framework. Django is a web framework written in python and is comparable to Ruby on Rails.
The application idea
Coming up with an idea of what to do for the Dash weekend was the smallest problem for me, as I have a collection of a few ideas flying around in my head. My goal was to create a shopping list application. The difference to just a shopping list was that users would be able to create 'their’ supermarket first, they would enter the order of categories as they are lined up in the supermarket of choice. Then when entering the items a user wants to buy the shopping list will be displayed in the correct order. So the items on the shopping list are in the same order as you can find the items in the supermarket. I thought this idea was good and sounded easy enough to complete in 48 hours (actually 48 hours minus some sleep).
The tools I have used
I have used Django before, but not for a project I started from scratch. This blog for example is developed using Django (see Django Mingus for more information), but I am just a user of the blog engine and have not done any development on it.
Django was not the only tool I was using for the first time. I needed to find a text editor to use for development. The ones I chose from included VIM (MacVim) and TextMate. I opted for TextMate as it is a pretty popular editor on Mac OS X and I have not used it. It was fun to use (I used a 30 days test version of it) and it worked pretty well. I liked the fact that I had the project overview and the file to edit in one program. I think TextMate is more than an editor, one could say it is an IDE of some sort.
Another tool I was using – inside of Django – was South for intelligent schema and data migrations. It was easy to install (using pip) and use – I’ll definately use it more often now that I came to use it for the first time.
For the frontend I did not want to write a lot of CSS and so went for Yet Another Multicolumn Layout for the layouting.
The good things
There were quite a few things that worked pretty well from the start. For instance I had no problem implementing the models and writing tests for them, that was pretty easy, see models.py on GitHub.
Another great Django feature is the Admin interface which enabled me to see how the models turned out pretty quickly.
What went wrong?
The first couple of hours of my Dash worked pretty well until I tried implementing the urls.py, views.py and the corresponding templates. There is such a thing called the RequestContext that you use to wrap to request and hand over to the template for access to several variables that the RequestContext provides. Now that I know it – it makes sense and all that, but it took me a while to figure out. It is especially important if you want the use authentication in your template.
Some more problems occured when I was trying to test the templates. As said in the tools section I used a CSS framework for the layouting of the templates. Now when I tried calling the templates from the browser using “python manage.py runserver” the static media files (images, CSS) were not displayed. What was the cause for that problem? Django does in its default settings not serve static files. In production one uses a web server to serve the static files – in development (by default) they are just not being served. To solve this, all you need to do is at:
if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT,
'show_indexes': True
}),
)</path>
to your urls.py. After that the media files are served by Django.
Then for the Dash I had the problem of not being too good in web design and design in general. This is pretty bad when you work on a site from top-to-bottom and do all of the work alone. So, what did I do? I tried to come up with a design:

I definately need to work on this one! ;-) Or the design in general.
What should I have done differently
- For one I should not have underestimated how much it takes to finish an app from scratch in 48 hours. If you check out the other participants you can see what is possible in the time frame – just not for me. So lots of respect for everyone who finished their project.
- As I am a beginner in Django, Frontend-Design and 'from-scratch-development’ I should have tried harder to find a partner or two to work with – some more experienced ones, enabling me to even learn more from their code / skills.
- Be better prepaired, as in know more about Django!
Do I regret taking part and do I think the 48 hours were a waste of time?
No, and you should take part next time, too. You learn a lot, trust me!
Further readings
Please let me know how you handle your Django project in the coments or via Email or via twitter.