Skip to main content

Reusable Django app for API request/event analytics, crash logging, and PII-safe masking, viewable in Django admin.

Project description

django-uxlite

Reusable Django app that adds UXCam-style request/event analytics, crash logging, and PII masking to API services (Django REST Framework friendly), all viewable in Django admin. No client-side JS or session replay — built for API-only backends.

Install

pip install -e /path/to/django-uxlite

Setup

  1. Add to INSTALLED_APPS:
INSTALLED_APPS = [
    ...,
    "uxlite",
]
  1. Add the middleware (near the top, after auth middleware so request.user is set):
MIDDLEWARE = [
    ...,
    "uxlite.middleware.UXLiteTrackingMiddleware",
]
  1. Migrate:
python manage.py migrate uxlite
  1. Optional settings (all have defaults, see uxlite/settings_defaults.py):
UXLITE_SENSITIVE_FIELDS = ["password", "token", "email", "card_number", "ssn"]
UXLITE_RETENTION_DAYS = 90
UXLITE_MASK_VALUE = "***"
UXLITE_TRACK_PATHS_EXCLUDE = ["/admin/", "/static/", "/media/", "/health/"]

Usage

Custom events

from uxlite.tracking import track_event

def checkout_view(request):
    ...
    track_event("checkout_completed", request=request, meta={"order_id": order.id, "email": user.email})

Sensitive keys in meta are masked automatically before being stored, based on UXLITE_SENSITIVE_FIELDS.

Crash logging

Wired up automatically via the got_request_exception signal — no extra code needed for exceptions that reach Django as unhandled (including plain Django views and any exception type DRF doesn't recognize).

If you're using Django REST Framework, DRF's own exception handler catches APIException/Http404/PermissionDenied before they become unhandled, which would otherwise hide 5xx-worthy failures from CrashLog. Opt in with:

REST_FRAMEWORK = {
    "EXCEPTION_HANDLER": "uxlite.exceptions.drf_exception_handler",
}

This still returns DRF's normal error response — it only additionally logs a CrashLog row when the resolved response status is 5xx.

Purge old data

python manage.py uxlite_purge

Deletes RequestLog, Event, and CrashLog rows older than UXLITE_RETENTION_DAYS. Session rows with no remaining RequestLog/Event rows are cleaned up too.

Admin

Everything (RequestLog, Session, Event, CrashLog) is registered in Django admin with search/filter support — no extra dashboard UI needed.

Out of scope (v1)

  • Pixel-accurate session replay (DOM/gesture recording)
  • AI-analyst / auto-insight generation
  • Client-side JS heatmaps

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

django_uxlite-0.2.2.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

django_uxlite-0.2.2-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file django_uxlite-0.2.2.tar.gz.

File metadata

  • Download URL: django_uxlite-0.2.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for django_uxlite-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5cb782fed25df0a3212fef566002aafee61150d191587f8d0c3dd005feb7797f
MD5 5d88bbdbdbe1bceb17fc448e22cd9cd1
BLAKE2b-256 cc811aad1125d2e7b5f48fbfb849a7066847e69c20949b3efc671d10aaa44f8e

See more details on using hashes here.

File details

Details for the file django_uxlite-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: django_uxlite-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for django_uxlite-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc58c1e27be0441dae0c24f1a4001460f0de132b7f0d56c1d2f9792a53c0c4a1
MD5 f355a893efc2736ed1bedaa85d9a3112
BLAKE2b-256 e7eec223f5fe3d86cf693d4d4cd120ec4695d4d8555777a470f1cca25d9a361b

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