twod.wsgi End-User Manual


To date, Django users have not been able to use the full potential of WSGI in their applications and that also affects the wider Python Web development community, which could be benefiting from reusable components written by Django users, who represent an important portion of said community.

In the beginning there was no support at all and nowadays compliance is nearly complete at the bare minimum level. This has been pointed out many times, by known members of both WSGI [1] and Django [2] communities.

WSGI is all about interoperability and that leads to reusability, in this sense, reusability beyond more of the same: From absolutely independent projects. And cooperation is the key.

twod.wsgi‘s aim is to be the “cooperation bridge” between Django and WSGI, until Django crosses this bridge. It is a very simple library made up of the following components:

  • A PasteDeploy application factory – which is possibly the flagship of the project.
  • Functions to run WSGI applications inside Django reliably.
  • An HttpRequest class extended by the fully-featured webob.Request (which is absolutely backwards compatible).
  • An optional HttpResponse class that supports custom HTTP status reason phrases, as allowed by the HTTP and WSGI specifications (which is absolutely backwards compatible).
  • A Django middleware which implements the wsgiorg.routing_args standard.
  • And yet another Nose plugin for Django, but this one is adapted to the PasteDeploy factory.

The author, who is a core developer at some mainstream WSGI projects, believes these components bring Django to the same level as frameworks like TurboGears, as far as WSGI support is concerned.

Hopefully after reading this manual you will realize how powerful WSGI can be! But keep in mind this manual simply describes the way third party software can be integrated in your application with twod.wsgi; you should still check the official documentation for that third party package.


[1]Django developer discovers WSGI...” by Mark Ramm.
[2]WSGI middleware is awesome, and Django should use it more” by Eric Florenzano and “Hot Django on WSGI Action” by Alex Gaynor.