Django http monitor is a Django app for record http request and response in debug.
Django http monitor is based on response header Request-UUID
, anyone has any questions about the request, just send me Request-UUID
in response header, we can see whole message what we what.
pip install django-http-monitor
Add "http_monitor" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'http_monitor',
]
Include the http monitor URLconf in your project urls.py like this::
url(r'^http_monitor/', include('http_monitor.urls')),
Add the HttpMonitorMiddleware for monitor request like this::
MIDDLEWARE_CLASSES = (
'http_monitor.middleware.HttpMonitorMiddleware',
...
)
Note HttpMonitorMiddleware should be in top of the middlewares, But GZipMiddleware will zip the content, so GZipMiddleware will be top.
Start the development server and visit http://127.0.0.1:8000/http_monitor/requests
A redis url for store debug message
a list for which prefix match list will be force record.
A list for which prefix start will be monitor, default is ['/']
A list for which prefix start will not be monitor, default is ['/http_monitor']
How long will redis expire the monitoring request, default is one week
A tuple or list for auth permission, default is None. if value is NULL or not set up, http_monitor will allow any user( include Anonymous User). For safety reasons, please set up, example:
HTTP_MONITOR_AUTH_PERMISSION = ('is_superuser', 'is_staff')
A boolean for dynamic prefix match list will be force record, default is False. Configure data is in redis, it is a set. The name of set is 'http_monitor_force_url'
HTTP_MONITOR_DYNAMIC_FORCE_URL_STATUS = True
Current we have three urls provide
^requests/
monitoring request list^requests/(?P<request_id>.*)/
monitoring request item^requests/(?P<request_id>.*)/raw/
monitoring request item response content(for content can't decode to json)^requests/(?P<request_id>.*)/retry/
retry request^settings/
settings
rm dist/*
python setup.py sdist bdist_wheel
twine upload dist/*