django-filer
django-filer copied to clipboard
Download counter with Django-Filer
Would there be an easy way to count the number of times a Django-Filer file is downloaded?
- You need to create extra model that will store that information and view that will serve the files and increase the counter.
- You need to configure your web server not to serve the files under
filer_public
folder and instead to pass the request to Django in order your custom view to be able to serve the file. - (Almost required) Because it's not a good idea Django to serve files in production your custom view probably need to leverage
django-sendfile
(https://pypi.python.org/pypi/django-sendfile) or similar approach of serving these files.
@maltebeckmann I'm sorry because source code is in italian, but you can have a look at this https://github.com/CroceRossaItaliana/jorvik/blob/master/gestione_file/viste.py#L86 for an implementation of a download counter
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This will now be closed due to inactivity, but feel free to reopen it.