Skip to main content

Django Audit is a simple Django app that tracks and logs requests to your application.

Project description

django-audit

GitHub issues PyPI - Downloads Codecov pre-commit

Django Audit is a simple Django app that tracks and logs requests to your application.

Quick Start

  1. Install django-audit
pip install dj-audit
  1. Add dj_audit to your INSTALLED_APPS:
INSTALLED_APPS = [
    ...,
    "dj_audit"
]
  1. Add dj_audit middleware:
MIDDLEWARE = [
    ...
    "dj_audit.middleware.AuditMiddleware"
]

if you want access to the dj-audit dashboard, then add the following to your urls.py

urlpatterns = [
    path("admin/", admin.site.urls),
    path("dj-audit/", include('dj_audit.urls'))
]
  1. Run migrate
python manage.py migrate

Management commands

flush_auditlog - Cleans up dj-audit AuditLog table

python manage.py flush_auditlog

Customizing dj-audit

You have a couple options available to you to customize dj-audit a bit. These should be defined in your settings.py file.

  • DISABLE_AUDIT_LOG: bool: Disable or Enable dj_audit
  • AUDIT_LOG_TEMPLATE: str: If set, the template here will be render when the user visits the audit log page (i.e /dj-audit/audit-logs/)
  • REQUEST_STATUS_TEMPLATE: str: If set, the template here will be render when the user visits the request status page (i.e /dj-audit/request-status/)
  • API_BASE_URL: str: Base url for API requests if any

Test

make test

or with coverage

make coverage_test

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

dj_audit-0.0.9.tar.gz (16.6 kB view hashes)

Uploaded Source

Built Distribution

dj_audit-0.0.9-py3-none-any.whl (20.0 kB view hashes)

Uploaded Python 3

Supported by

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