David S. wrote:
> I am wondering how best to serve PDF files in Django.
>
> I am using ReportLab to generate a file.
>
> So should I name it and place it where the server can fetch it?
>
> Does the URL have to end in pdf for it to be handled by the browser?
>
> Can I configure the development server to this task?
>
> Thanks for any help.
>
> Peace,
> David S.
>
>
>
Hi,
You are best off sticking all your generated files in a dedicated
directory, and serving them up using your normal webserver.
Eg in apache, have something like
DocumentRoot /path/to/parent/directory/
<Location "/gen">
SetHandler None
</Location>
and then stuff your pdfs in /path/to/parent/directory/gen/
For performance reasons its better to serve this and all other static
files with a different webserver, eg another apache with no modpython
loaded, or lighttpd.
The dev server is not designed to serve static files.
Robert