Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A reusable Django app to track download statistis.

Project Description

Django Download Stats

A reusable Django app to keep track of file download statistics.


To get the latest stable release from PyPi::

$ pip install django-download-stats

To get the latest commit from GitHub::

$ pip install -e git://

Add ``download_stats`` to your ``INSTALLED_APPS``::


Define ``DOWNLOAD_URL`` in your settings if you want to override the default
of ``/downloads/``::

DOWNLOAD_URL = "/my-download/"

Add the ``download_stats`` URLs to your ````::

urlpatterns = patterns('',
url(r'^myurlname/', include('download_stats.urls')),

An important note is, that the ``download_stats.urls`` will automatically
prepend the ``DOWNLOAD_URL`` setting. So the following urls example would
result in urls formatted like ````
considering if you would leave the ``DOWNLOAD_URL`` on its default value

urlpatterns = patterns('',
url(r'^', include('download_stats.urls')),

Why this setting anyway then?
Because now you will add the context processor::


This will add the ``DOWNLOAD_URL`` variable to all templates.

Don't forget to migrate your database::

./ migrate download_stats


With our context processor adding ``DOWNLOAD_URL`` you can basically use the
view that comes with download stats just like you would do it before, just
replacing ``MEDIA_URL`` with ``DOWNLOAD_URL``::

<a href="{{ DOWNLOAD_URL }}files/myfile.pdf">Click to download my file</a>

It will then automatically count how often ``files/myfile.pdf`` was clicked.

You can then view the individual file counts in the download stats admin.


If you want to contribute to this project, please perform the following steps::

# Fork this repository
# Clone your fork
$ mkvirtualenv -p python2.7 django-download-stats
$ python install
$ pip install -r dev_requirements.txt

$ git co -b feature_branch master
# Implement your feature and tests
$ git add . && git commit
$ git push -u origin feature_branch
# Send us a pull request for your feature branch

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(8.1 kB) Copy SHA256 Hash SHA256
Source None Jul 3, 2013

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers