Streaming templating languages for use as WSGI body.

Adam Tauno Williams awilliam at whitemice.org
Thu Jan 6 13:00:39 EST 2011


On Wed, 2011-01-05 at 14:56 -0800, Alice Bevan–McGregor wrote:
> Howdy!
> I'm trying to find a templating engine whose templates can be consumed 
> directly as a WSGI response body iterable.  So far I haven't been very 
> successful with Google; the engines I've found universally generate a 
> monolithic rendered string.

With HTTP/1.0 [and WSGI is HTTP/1.0 only] you have to provide a
Content-Length header - so you have to generate the entire response at
once [however you want to muddy "at once"].

Streaming responses to the client requires Chunked-Encoding [HTTP/1.1]
which is not possible via WSGI.

It took me quite awhile to believe that, but there it is.  I ditched
WSGI; handling HTTP isn't that hard.






More information about the Python-list mailing list