django-request is a statistics module for django. It stores requests in a database for admins to see, it can also be used to get statistics on who is online etc.
Quick start guide¶
To find the request overview page, please click on Requests inside the admin, then “Overview” on the top right, next to “add”.
Once you have installed django-request you can add it to a django project by following these steps;
- Install the blog app by adding 'request' to INSTALLED_APPS.
- Run manage.py syncdb so that Django will create the database tables.
- Add request.middleware.RequestMiddleware to MIDDLEWARE_CLASSES. If you use django.contrib.auth, place RequestMiddleware after it. If you use django.contrib.flatpages place request.middleware.RequestMiddleware before it else flatpages will be marked as error pages in the admin panel.
- Make sure that the domain name in django.contrib.sites admin is correct. This is used to calculate unique visitors and top referrers.
This command can be used to purge old requests, it takes two arguments amount and duration. Example:
$ python manage.py purgerequests 1 month $ python manage.py purgerequests 2 weeks
It also has a option called --noinput, if this is supplied, it will not ask you to confirm. With this option you can use this command in a cron.
Valid durations: days(s), week(s), month(s), year(s)