Skip to content
(experiment!) This package provides an easy API for moving the work out of the tornado process / event loop.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This app makes non-blocking django ORM calls possible.


pip install "tornado >= 1.2" pip install django-async-orm

FIXME: this is not uploaded to pypi now


This app can be used for tornado + django integration: run tornado as django management command (on a separate port) => all django code will be available in tornado process; then use this library instead of plain django ORM calls in Tornado handlers to make these calls non-blocking.

from django.contrib.auth.models import User
from async_orm.incarnations.http import AsyncWrapper

AsyncUser = AsyncWrapper(User)

# ...

def process_data(self):
    # all the django orm syntax is supported here
    qs = AsyncUser.objects.filter(is_staff=True)[:5]

def on_ready(self, users):
    # do something with query result
    print users

or, with pep-342 syntax and adisp library (it is bundled):

from async_orm.vendor import adisp

def process_data(self):
    qs = AsyncUser.objects.filter(is_staff=True)[:5]
    users = yield qs.fetch()
    print users

You still can't rely on third-party code that uses django ORM in Tornado handlers but it is at least easy to reimplement it now if necessary.

Currently the only implemented method for offloading query execution from the ioloop is to execute the blocking code in a django view and fetch results using tornado's AsyncHttpClient. This way it was possible to get a simple implementation, easy deployment and a thread pool (managed by webserver) for free. HTTP, however, can cause a significant overhead.

Please dig into source code for more info, this README is totally incomplete.

TODO: proper usage guide: how to configure django for this? how to deploy?


(async.incarnations.http.urls must be included in urls)

TODO: write this




If you have any suggestions, bug reports or annoyances please report them to the issue tracker at

Both hg and git pull requests are welcome!



Third-party software: adisp (tornado implementation is taken from brukva).


The license is MIT.

Bundled adisp library uses Simplified BSD License.

Something went wrong with that request. Please try again.