Handling static files with Django / lighttpd

I know there is already a question for this question (actually a little more, actually), but the answers didn't help me much since I'm pretty new to lighttpd.

I have one folder containing .pdf files. When executing HttpResponseRedirect at the locations of one of these .pdf files, the user should be able to download the .pdf file (or view it in a browser). Right now, Django just redirects to my html home page, not showing any PDF.

Somehow I'll have to tell lighttpd that Django should no longer handle this directory. Is this the only thing I need to do? If so, how should I do this?

+2


a source to share


1 answer


Have you seen the " lighttpd setup " section in the Django docs? Using alias.url url.rewrite - as soon as you can redirect requests to your application or folders serving files:



alias.url = (
    "/pdfs" => "/path/to/my/pdfs",
)

url.rewrite-once = (
    "^(/pdfs.*)$" => "$1",
    "^(/.*)$" => "/mysite.fcgi$1",
)

      

+5


a source







All Articles