Django file download count

Django file download count

django file download count

Using Nginx's X-Accel-Redirect you can apply permissions to files served whether that's checking permissions, updating a download count, or emailing you to. View the additional settings section for a list of the django-hitcount settings that The main business-logic for evaluating and counting a Hit is done in hitcount.​views. If you wish to use the HitCountJSONView in your project you first need to update your urls.py file to include the following: Downloads: PDF · HTML · Epub. Welcome to the second post of Django Packages Series. So, it will not count clicks properly, views will increase every time when same user clicks to You can download or clone the project on my GitHub File "", line 1, in. django file download count

Project description

Django Download Stats
=====================

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

Installation
------------

To get the latest stable release from PyPi::

$ pip install django-download-stats

To get the latest commit from GitHub::

$ pip install -e git://github.com/bitmazk/django-download-stats.git#egg=download_stats


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

INSTALLED_APPS = (
...,
'download_stats',
)

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 ``urls.py``::

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 ``example.com/downloads/filename.jpg``
considering if you would leave the ``DOWNLOAD_URL`` on its default value
``/downloads/``.

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

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

TEMPLATE_CONTEXT_PROCESSORS = [
...
'download_stats.context_processors.download_url',
]

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

Don't forget to migrate your database::

./manage.py migrate download_stats


Usage
-----

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.


Contribute
----------

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 setup.py 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

Download files

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

Filename, sizeFile typePython versionUpload dateHashes
Filename, size django-download-stats-0.2.tar.gz (8.1 kB) File type Source Python version None Upload dateHashes View
Close

Hashes for django-download-stats-0.2.tar.gz

AlgorithmHash digest
SHA256
MD5
BLAKE2-256
Источник: [https://torrent-igruha.org/3551-portal.html]

Django file download count

0 thoughts to “Django file download count”

Leave a Reply

Your email address will not be published. Required fields are marked *