A very simple middleware based page view counter. It's sole purpose is to increment page views.
- Install from github or clone the repository:
pip install git+git://github.com/renyi/django-pageviews.git
- Add 'pageviews' to INSTALLED_APPS.
INSTALLED_APPS = (
"...",
"pageviews",
)
- Add 'pageviews.middleware.PageViewsMiddleware' to MIDDLEWARE_CLASSES.
MIDDLEWARE_CLASSES = (
"...",
"pageviews.middleware.PageViewsMiddleware"
)
- Run 'python manage.py syncdb' or 'python manage.py migrate'.
python manage.py migrate
-
Add {% load pageviews_tags %} to templates.
-
Insert {% pageviews %} or {% pageviews_url request.path %} to templates.