Skip to main content

Django Request Viewer

Log and view requests and exceptions made on your Django App

Updates 17th, January 2022

  • Adds Exception logger
  • Cleaned up the code

Introduction

Screenshot 2021-03-29 at 09 30 17

Recently, @ichtrojan and @toniastro released horus, a request logger and viewer for Go. Then I felt the need for something like that for the Django community.

Installation

Install using pip

pip install django-request-viewer

Usage

Add 'request-viewer' to your INSTALLED_APPS in settings.py.

INSTALLED_APPS = [
    ...
    'request_viewer',
    ...
]

Add 'request_viewer.middleware.RequestViewerMiddleware' to your MIDDLEWARE list in settings.py.

MIDDLEWARE = [
    ...
    'request_viewer.middleware.RequestViewerMiddleware',
    ...
]  
To log exceptions, add

Add 'request_viewer.middleware.ExceptionMiddleware' to your MIDDLEWARE list in settings.py.

MIDDLEWARE = [
    ...
    'request_viewer.middleware.ExceptionMiddleware',
    ...
]  

Add 'request-viewer' to your main urls.py

urlpatterns = [
  ...
  path('logs/', include('request_viewer.urls'))
  ...
]

Run migrations, python manage.py migrate request_viewer

OPTIONAL

Add REQUEST_VIEWER dictionary to your settings.py.

LIVE_MONITORING: Default: True, False to pause monitoring.

WHITELISTED_PATH: Default: [], This is a list of paths to be excluded when monitoring

{
  "LIVE_MONITORING": True,
  "WHITELISTED_PATH": ['admin/']
}

Note: Media url, Static url and request-viewer url are automatically excluded.

Start your server and head to http://localhost:8000/logs/request-viewer to view requests

Head to http://localhost:8000/logs/request-viewer/exceptions to view exceptions

View your request logs.

Screenshot 2021-03-29 at 09 30 33

Contribute

Well, no big drama, fork the repo and make pull requests, easy-peasy, right?

TODO

  • JSON export
  • Caching
  • Create an African unicorn
  • Buy a yacht

Credits

Follow me (I am not boring, I promise)

Metadata

Release files for django-request-viewer 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-request-viewer 1.0.3
File Size Uploaded
django-request-viewer-1.0.3.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-request-viewer 1.0.3
File Interpreter ABI Platform
django_request_viewer-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / django-request-viewer-1.0.3.tar.gz

Download URL django-request-viewer-1.0.3.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bdda0d867414c794225b3d284c626dad5e8975758d76f87fa7bb3356955accbd
BLAKE2b-256 checksum
How to use checksums
24c5a18c951e5636c07b4aba70425d2deef609c68355f9593cd9d4c586dfc97c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5

Release files / django_request_viewer-1.0.3-py3-none-any.whl

Download URL django_request_viewer-1.0.3-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b73bd3e4c4d82b0a41339c9f2b2d161e9ba5968dabcc94e54a263849198bc85
BLAKE2b-256 checksum
How to use checksums
7ae3992e81a3b99f340e365e99aaf7be2219a29aeb1c81d4e9d7954c8afc10aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.5

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page