Skip to main content

A reusable django [DRF] application that handles auditing of requests, logins and process

Project description

DRF Audit Trail

A reusable Django [DRF] application that handles auditing of requests and logins.

Features

  • Request audit trail
  • Logins audit trail
  • Integration with simplejwt
  • Support for Django Async
  • Thread Safe
  • Error tracking

Usage

To use this app, you need to install it, add it to the Django INSTALLED_APPS, and configure the middleware in your Django settings.

Installation

pip install drf-audit-trail

Configuration

Add to Django INSTALLED_APPS

# settings.py

INSTALLED_APPS = [
    ...
    "drf_audit_trail",
]

Configure the middleware

Add to Django MIDDLEWARE configuration

# settings.py

MIDDLEWARE = [
    ...
    "drf_audit_trail.middleware.RequestLoginAuditEventMiddleware",
]

Settings

In your settings.py, configure

DRF_AUDIT_TRAIL_REQUEST_AUDIT_URLS: A list that accepts regex patterns indicating which URLs should be tracked.

Example:

Default: [r"^/api/.*?/"]

DRF_AUDIT_TRAIL_REQUEST_AUDIT_URLS = [r"^/api/.*?/"]

This means that all requests starting with /api/ will be tracked.


DRF_AUDIT_TRAIL_AUTH_URL: The endpoint used to authenticate users.

Default: /api/token/

DRF_AUDIT_TRAIL_AUTH_URL = "/api/token/"

DRF_AUDIT_TRAIL_AUTH_STATUS_CODE_FAILED: The status code returned when the auth request failed

Default: 401

DRF_AUDIT_TRAIL_AUTH_STATUS_CODE_FAILED = 401

Flow

DER

DER

DER

RequestLoginAuditEventMiddleware class diagram

DER

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf_audit_trail-0.3.5.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drf_audit_trail-0.3.5-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file drf_audit_trail-0.3.5.tar.gz.

File metadata

  • Download URL: drf_audit_trail-0.3.5.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.12 Linux/6.8.0-57-generic

File hashes

Hashes for drf_audit_trail-0.3.5.tar.gz
Algorithm Hash digest
SHA256 1ce9ef1c231b0867061ea3ee7773bbbf304d8d183a00406d2f76c2458ac7a0ad
MD5 17f9536fd0f07af6218a2cecfa4eaf63
BLAKE2b-256 8f5aea4e32f7eaea5a579af8bdbab25ab0524e68270869dee210bf960e0424bf

See more details on using hashes here.

File details

Details for the file drf_audit_trail-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: drf_audit_trail-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.12 Linux/6.8.0-57-generic

File hashes

Hashes for drf_audit_trail-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f794c1f2405e9742cc9c3517e9b824df04a78f5d10f49fab58c2978e0a1b5ebe
MD5 4f8a6a3049e4be4fca9c3438b50d8f78
BLAKE2b-256 54f3c99cd55961d4c5d452cb7e8eb22aac91dd0145f49d38df804a5bc38601f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page