An iPhone-Python love affair: Building APIs for mobile - Nate Aune, Anna Callahan (

Tags: djangocon, django

Nate and Anna gave the presentation together in a very nice, fresh, cooperative way. It really grabbed your interest. They showed a quick regular web app for sending a customized valentine day playlist to your sweetie (written in 24 hours in some hack marathon). They wanted to get it to cooperate with a native app on an iphone.

“Django, the web framework for romantics with deadlines” they called it :-)

In a lot of countries, the only way to access the internet is via a phone. Mobile usage is increasing all the time. So you will support mobile.

Mobile: can’t you just use some REST api and be done with it? The problem is that connections are slow, spotty or non-existent. And a phone is small and not so powerful. And people Do Not Want To Wait.

So if you return data, return as much as possible in one go, don’t assume that the next connection will just work. Send over hierarchies of data. Not just return a flat list of objects and afterwards another list, but return the first objects combined with the objects they link to. They build it with tastypie.

Regarding error codes: never ever return html. Tailor response codes to actions on the device. So one response code that pops up a message box on the mobile device. Another response code that just fails silently. So you send over both an error code and a message. Different error codes result in other actions in the iphone interface.

What helped them a lot was IRC. You can get very good help that way. For instance on django. Especially Daniel Lindsley’s IRC help on TastyPie was amazing and helpful.

Wooden velomobile. Wonderful. Real wood. logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):