Django app that tracks all user requests and saves following data to database:
- user
- request method
- response status code
- IP address
- URL path
- GET parameters
- POST data
- session
- language code
- timezone
- content type
- user agent
- response content (if internal server error occures)
- is_secure flag
- is_ajax flag
- is_debug flag
- created and modified timestamps
Tested on Django 1.4.5 and Django 1.8.3
- Django
- Install python library using pip:
pip install django-detective
- Add
detective
toINSTALLED_APPS
in your Django settings file - Add
detective.middleware.TrackingMiddleware
toMIDDLEWARE_CLASSES
in your Django settings file - Include
detective.urls
in your urls.py withdetective
namespace - Sync your database
- DETECTIVE_SAVE_RESPONSES
- If True, response data will be saved in database. Default:
False
. - DETECTIVE_SAVE_ERROR_RESPONSES
- If True, internal server error responses with exception (500) are stored in database. Default:
True
. - DETECTIVE_TRACK_AJAX_REQUESTS
- If False, ajax requests won't be tracked. Default:
True
. - DETECTIVE_TRACK_ANONYMOUS_REQUESTS
- If False, anonymous requests won't be tracked. Default:
True
.
Library is by Erik Telepovsky from Pragmatic Mates. See our other libraries.