This release is a pre-release and may not be stable for production use.
🛟 Crashpad - A Soft Landing for Your Django Crashes
Error tracking SDK for Django and Django REST Framework applications. When your code crashes, Crashpad catches it gracefully.
✨ Features
- 🎯 Zero Configuration: One line to set up, no middleware needed
- 🔍 Full Context Capture: Automatically captures request info, user details, and code snapshots
- 🚀 Django & DRF Support: Works seamlessly with both Django and Django REST Framework
- 🧵 Thread-Safe: Uses thread-local storage for reliable request tracking
- 📸 Code Snapshots: Shows the exact lines of code where errors occurred
- 🔄 Reversed Stack Traces: Error message first, most recent call first - easier to read
- 🤮 Debug Mode: Save errors locally with the hilarious
logs🤮directory
📦 Installation
pip install crashpad
🚀 Quick Start
Django Setup
In your Django settings.py:
import crashpad
# Initialize with your API key URL - that's it!
crashpad.init(key="http://your-api-server.com/YOUR_PROJECT_KEY")
Django REST Framework Setup
Same simple setup for DRF:
import crashpad
# Initialize Crashpad
crashpad.init(key="http://your-api-server.com/YOUR_PROJECT_KEY")
That's it! No middleware, no additional configuration needed. Crashpad automatically captures all errors using Django signals.
📊 What Gets Tracked
When an error occurs, Crashpad automatically captures:
- Error details: Exception type, message, and reversed stack trace (error first!)
- Code snapshot: The exact lines of code around where the error occurred
- Request information:
- HTTP method (GET, POST, PUT, DELETE, etc.)
- Full URL path
- Authenticated user or "anonymous"
- File location: Filename, function name, and line number
- Timestamp: Exact time when the error occurred
🎯 Example
Here's a complete example with Django settings:
# settings.py
import crashpad
# Initialize Crashpad - one line!
crashpad.init(key="http://127.0.0.1:9000/your-project-key")
# Your regular Django/DRF settings continue...
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'rest_framework',
# ... your apps
]
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 100,
}
🔧 How It Works
- Signal-Based Integration: Connects to Django's
got_request_exceptionsignal - Automatic Request Capture: Uses a logging filter to extract request information
- Thread-Local Storage: Safely stores request context during error handling
- No Middleware Required: Works automatically without middleware configuration
- Universal Coverage: Captures errors from views, DRF endpoints, background tasks, and logging calls
- Smart Extraction: Safely extracts HTTP method, URL, and user information
- Flexible Deployment: Send to API in production, save locally in debug mode
🐛 Debug Mode
Want to see errors saved locally? Enable debug mode:
import crashpad
crashpad.DEBUG = True
crashpad.init(key="http://your-api-server.com/YOUR_PROJECT_KEY")
Errors will be saved to a logs🤮 directory as JSON files. Yes, the emoji is intentional! 🤮
📋 Requirements
- Python 3.6+
- Django 3.2+
- Django REST Framework (optional, for DRF integration)
📄 License
MIT License - see LICENSE file for details
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
🎯 Why "Crashpad"?
Because when your code takes a dive, it deserves a soft landing! 🛟
Made with ❤️ for Django developers who believe error tracking shouldn't be complicated.
Metadata
Release files for crashpad 0.1.0b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crashpad-0.1.0b0.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crashpad-0.1.0b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.2 kB
Release files / crashpad-0.1.0b0.tar.gz
| Download URL | crashpad-0.1.0b0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cb1b0f3e2268142695735e9575edc5ada9e53535d047f039ab0ac697c764ade
|
|
BLAKE2b-256 checksum How to use checksums |
29c1e10bc25571ad97ab5766567fece01adb8a13295ef76d82992d4f6414e263
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|
Release files / crashpad-0.1.0b0-py3-none-any.whl
| Download URL | crashpad-0.1.0b0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96ba76f0ad978f13c1660bf2d82da1c8db408bdc746acd95dbfe8f5958c57196
|
|
BLAKE2b-256 checksum How to use checksums |
b01c21db8a4e21b0eb65cdc24d554d715000c05eae201d5e68f17c978e0bc119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|