Developer competitions are often fun, Django Dash was no different this year. Over this past weekend I participated in Django Dash 2012 with my best friend Shane Cowherd. It was a bit grueling at times especially when my allergies kicked in, and my eyes hurt.
To start I am going to hit on the project, a little history, and the concept. Then move into the “how” we did the competition. Finally, going to take note of some of the things I learned and accomplishments.
We named our project Crowd Photo and it is a site for people who need specific pictures from around the world, and are unable to take them themselves. The idea started when a friend whom is a blogger needed pictures of Japan. His solution was offering a bounty for specific shots on his blog, and several local, japanese, photographers went out and took them for him. Same concept more formalized, picture bounties are a future feature.
So far “all we have” in place is you register with Facebook, and make requests via a form and/or dropping a pin on a map. Photographers can look at what people what photographs of and multiple people can upload pictures of the same requests. It also looks good too.
How We Collaborated
Since this was a 2 person team it was fairly simple choice on how to collaborate. On my mac I was sharing my screen with Shane using join.me. He had my screen running on his second computer/monitor. I had his screen on my second computer as well. This worked out great because if we ever got stuck we just looked at each others screens and talked it through. To talk to each other we just used FaceTime on our iPad’s and all was well. It quite honestly felt very much like we were in the same room even though I am in Oklahoma and he is in Colorado.
As per the rules we OSS’d the project. We chose git on Github and you can view the Crowd Photo source code on github. While our commit log is crazy it was fun to really do some real collaboration with someone for a change. We had some amazing moments where we had large amounts of code both of us wrote and then we merged each others changes and we had no problems, fun feeling.
If you talk to people closest to me I produce a lot of projects. One of the reasons is I make sure with every new project I learn something new. No matter what it is I do I make sure to learn something new and if I don’t I have failed. On that metric Django Dash was a resounding success. I had many successes, but want to talk about my two biggest accomplishments. Following that I want to hit on my a failure and a realization.
ImageField and S3
I haven’t done a lot with image uploading in the past. I can name a grand total of 2 projects, so using the ImageField was new to me on this project because the last two times I used a CharField. Not only did I need to use ImageField, but it had to be uploaded to Amazon S3 as well since hosting was done on Heroku.
I did learn what it takes to do upload to S3 and how to use ImageField, but it wasn’t quite straight forward. The couple of take aways I learned was you really should use django-storages with the boto package to replace the default backend. This makes life so much easier than dealing directly with boto, which I have done. The other thing I found out, painfully so, was the uploadedfile object that goes to the backend is stored as cStringIO so you have to write the file as if it was a string. That one connection has made quite a few things make sense for me in Django. So note that when saving uploaded files.
Output as JSON
A lot of times when doing ajax “stuff” I have wanted to output data as JSON. Problem is I have never been able to figure out how to do it well. I have just always gotten it to work without figuring out how. Well I ran into my not being able to do it this weekend and I figured out the crux of how to do it. Without too many details django has a built in json serializer, and when you do a query for an object use objects.filter() instead of objects.get(). In the future I will be able to get it done better.
Failure – Unit Testing
Over the last many months I have gotten better at writing unit tests. I was pretty excited going in, and started doing unit tests. However, as time went on I found my problem areas with unit testing and I finally dropped off doing them because I didn’t know how on a couple of spots. I now know my problem areas better and am going to fix them, soon.
Realization – Backbone.js
The only thing I want to change for next year was the fact I spent several hours with my eyes stinging due to pollen allergies. At one point my eyes were watering for about 10 minutes, not easy to see through that. I spent about 2 hours with a wash cloth on my eyes, and afterwards things got better and I got back to it. The allergies distracted me from lack of sleep so not sure how much of a role that played.
I will definitely do this again next year, if I can. Being much more confident in Django getting things done quickly, and well; I am excited to see what the future holds. I know my skill levels as a developer and can do what needs to be done most of the time. However, competitions like these really help to show me where my skills are truly at because in a pinch is where you write your poorest code. If it is good you aren’t doing to bad as a developer. I re-assured myself I am no longer some beginner developer who can’t figure out how to get things done and done well, I used to feel like that for a long time.
On a final note I want to thank everyone that ran the event as it was a lot of fun, and well run. There was some fun discussion in the irc channel. I was happy people were generally willing to help each other even though they where in competition with each other. I very much recommend you doing one of these sometime if you haven’t. Checkout Rails Rumble and Node Knockout for alternatives to Django Dash.