Hello Tim Am 05.04.2008 um 21:19 schrieb Tim Sawyer: > > I'd like to have a site that gives away and sells PDFs, and tracks > downloads > of those PDFs.
I hope I got your question right. I have a little bit different aproach since django never serves the file directly. If you are using nginx as a frontend-proxy and static file serving just configure a protected-download-dir: location /protected-downloads/ { alias /var/protected/; internal; } The "internal" is to disallow regular gets so your file is not downloadable without the "OK" from your view. Now you can send a X-Accel-Redirect Header from your view to let the nginx send a file: @login_required def download(request, file=None): response = HttpResponse() response['Content-Type'] = 'application/octet-stream' response['X-Accel-Redirect'] = '/protected-downloads/' + file return response Of course you can do additional processing in download as storing the IP and download count to your database. This soulution has the advantage that your files can be served very quickly from your proxy instead of a relatively slow mod_python-apache. If you are using Apache or lighttpd as a frontend-proxy you can use a similar aproach with: X-Sendfile. Or you use Amazon s3 etc... Greets, Thomas Kerpe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---