[reportlab-users] Generic mod_python error when returning pdf

Robin Becker robin at reportlab.com
Tue Oct 13 07:26:57 EDT 2009


Simone Dalmasso wrote:

> Hi, list. Months ago I built a web app under django which through a button

> creates a pdf and returns it via an HttpResponse. All worked fine util the

> app was under the django development server but now, trying to deploy under

> mod_python, it breaks when the server try to send the pdf. What I get is a

> generic mod_python error.

> The way I create the pdf is like this:

> response = HttpResponse(mimetype = "application/pdf")

> response['Content-Disposition'] = 'attachment;

> filename=Fasst-laboratories.pdf'

> doc = SimpleDocTemplate(response, topMargin = 1 *cm)

> and more...

> then I return the response variable to another method which handle the http

> request and sends back the response to the client.

>

........

effectively you are relying on SimpleDocTemplate to write into the response;
according to my understanding that should work. However, without knowing what
the error is makes it hard to figure out what mod_python is whining about. Have
you looked in the apache error logs to see if there's anything obvious going on.

A few years ago when we started with django we used mod_python, but several
things put us off. Firstly we had problems related to tight binding of
apache/python/os etc etc and thene teher were issues about separation of virtual
hosts; at one pint we used a two layer scheme with the VMs on the top layer
passing to individual apaches running the applications with a mod_python for each.

We eventually switched to fastcgi using flup. That has proved very flexible and
stable and allows us to use different versions of django python etc etc.
--
Robin Becker


More information about the reportlab-users mailing list