After several weeks there is a new release of Dojango and this release introduces the compatibility to Google’s AppEngine. AppEngine delivers helpers so that Django applications can run on Google’s server farm and now this release of dojango allows the deployment of Dojo powered web applications to it.

At the moment AppEngine just supports version 0.96 (see Google AppEngine Helper for Django) of Django and dojango is now able to run with this old version.

Since dojo’s variety of modules easily excesses the limitation of Google’s AppEngine of 1000 files, dojango now can solve this problem with an extreme mini build that just keeps the basic dojo files and all image files. I have to mention that this build removes all js-files that could be postloaded on a page using dojo.require. This means, that a dojo.require on Dojo modules that weren’t included in the Dojo build profile would not work anymore. So, when using the extreme mini build, you have to add all Dojo modules, that are used within the deployed application, to your Dojo build profile.

I’ll show the deployment to AppEngine of a dojango application and the building of a Dojo release with the extreme mini build in another blog entry.

Dojango 0.3.1 also had some other changes, like the addition of Dojo 1.2 as the new default Dojo version for dojango and Google is now used as the default CDN instead of AOL.

Also two new decorator functions found their way into dojango.

One is the json_iframe_response decorator that makes it easier to return json data when dojo.io.iframe is used. dojo.io.iframe is utilized e.g., if you want to submit multipart/form-data forms with file fields in the background. Here is a simple example, how to use that decorator:

The Django side:

from dojango.decorators import json_iframe_response

@json_iframe_response
def my_view(request):
    # do your file handling here
    # and just return simple python objects like booleans,
    # Strings, integers, dictionaries, lists, ...
    # the decorator does the rest for you
    return {'success': True}

The Dojo side:

dojo.require("dojo.io.iframe");
dojo.io.iframe.send(
    {
      url:"/my-view/",
      form: dojo.byId("my_file_upload_form"),
      handleAs: "json",
      load: function(response){console.log(response);}
    }
);

The other decorator jsonp_response can enable django views to deliver json data to foreign web applications using JSONP. You need that, if you want to make several django views available as your external API. Here is a short usage example:

The Django side:

from dojango.decorators import jsonp_response

@jsonp_response
def my_view(request):
    # prepare and return your data
    return {'success': True}

The Dojo side:

dojo.require("dojo.io.script");
dojo.io.script.get(
    {
      url:"/my-view/",
      data: {doIt: true},
      handleAs: "json",
      load: function(response){console.log(response);},
      // the returned json data is wrapped into that function!
      // always add that parameter
      callbackParamName: "jsonp_callback"
    }
);

For the next release we planned to take JSON-RPC, SMD (Simple Method Description) and maybe CometD into account. If you are interested in other features please don’t hesitate to contact us.