Home > django-hits

django-hits

Django-hits is a project mainly written in ..., it's free.

A django app that counts page hits

This app ables you to count hits of your site web pages as easy as possible using template tags. It stores useful infos of each visitor for you as well. By web pages I mean it counts hits of different urls. If you use it in a template that shares among lots of urls for each url it stores number of visits.

Installation of this app is easy. Put the following (if you have not already) in the settings.py of your project:

TEMPLATE_CONTEXT_PROCESSORS =( 'django.core.context_processors.request', "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.static", "django.contrib.messages.context_processors.messages" )

Extract .tar.gz file as djangohits directory in your project root directory and do the following:

INSTALLED_APPS = ( ... djangohits, ... )

now ./manage.py syncdb (or use migration) to create database table and make the app working. you can use customized admin for better exprience: add the following to admin.py of your app:

from djangohits.admin_view import VisitorAdmin admin.site.register(Visitor,VisitorAdmin)

How to use it? Just load the template tag by: {%load hit_counter%} and after that putting: {% hit_counter %} and it will count hits of the page (url) and replaces the tag with number of hits up to now.

you can use {% silent_hit %} as well that doesn't return anything but just counts hits of the url.

Previous:Atlantic