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
- Add to
INSTALLED_APPS:
INSTALLED_APPS = [
...,
"uxlite",
]
- Add the middleware (near the top, after auth middleware so
request.useris set):
MIDDLEWARE = [
...,
"uxlite.middleware.UXLiteTrackingMiddleware",
]
- Migrate:
python manage.py migrate uxlite
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_uxlite-0.2.1.tar.gz.
File metadata
- Download URL: django_uxlite-0.2.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
761e4c26aebc14e5f587f21879772597e15e31cd2cb82aece9eb15465cec6b2b
|
|
| MD5 |
7ee67a10b950aa02eb21220eb7e84138
|
|
| BLAKE2b-256 |
fec2a275e3713a19da420e22afcb2c75eb0fc4ff90e5087c639c1c9fb2584403
|
File details
Details for the file django_uxlite-0.2.1-py3-none-any.whl.
File metadata
- Download URL: django_uxlite-0.2.1-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f540bdabdf019287907746994777c0e60a62da5d9acf4a564aa829efb6f5bcdd
|
|
| MD5 |
aa75f471d610c5f03909b9904e5ab2b3
|
|
| BLAKE2b-256 |
e4085d32266a8b66dd45b788f9d558469cd442e3421682a37a9e0ab0196468f9
|