eriksmartt.com>Selected Archives

Apache and mod_python for S60

Nokia Research Center (NRC) has published a port of Apache for S60 which includes mod_python built for Python for S60. Once installed, you can run Apache on your phone and serve Python-based web applications that utilize the full (non-GUI) API of Python for S60!

Running a server on the phone opens up a whole new class of mobile applications. The obvious "Hello World" for this environment would be a web-cam (which is included as an example) as well as a URL to query the device's location and possibly share calendar and contacts data (all of which have Python APIs.) Add a Bluetooth GPS, and a Google Maps mashup plotting phone positions is only a few lines of code away.

The release notes focus on the (optional) gateway to bridge the wired internet to mobile servers, which is very cool, but even without the gateway this software has potential as a unique tool for mobile web developers thanks to its ability to serve content to local browsers. Once you've installed Apache, all you need to do is select "Options > Start Non-Cellular" from within the application (called Racoon.) This will launch Apache and you can connect to it on 127.0.0.1 from a local web browser, as shown in the following screenshots:

starting apache

connecting to local apache server

viewing local server

Combining the on-device server with a few Python for S60 scripts, you now have the potential for a rapid round-trip when optimizing a mobile web page design. The Python for S60 project includes a script for directory synchronization over Bluetooth. The idea was to make it extremely easy to edit Python scripts on a PC and sync with a phone for testing. This idea could easily be extended though, so that you're synchronizing Apache's DocumentRoot instead. With a sync daemon like this, the round-trip from editing XHTML on your desktop to previewing on-device could be as simple as hitting "Save" in your text editor and "Reload" in your phone's browser. No need to upload pages to a server or have a data-plan for the phone. That's killer!