https://github.com/andrewpetrochenkov/django-command-exception.py
Django python exception model, admin, logging handler, middleware and excepthook
https://github.com/andrewpetrochenkov/django-command-exception.py
django error-handling exceptions logging
Last synced: about 2 months ago
JSON representation
Django python exception model, admin, logging handler, middleware and excepthook
- Host: GitHub
- URL: https://github.com/andrewpetrochenkov/django-command-exception.py
- Owner: andrewpetrochenkov
- License: unlicense
- Created: 2024-06-28T08:49:48.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-20T15:10:00.000Z (almost 2 years ago)
- Last Synced: 2025-07-12T07:33:18.383Z (12 months ago)
- Topics: django, error-handling, exceptions, logging
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Installation
```bash
$ pip install django-command-exception
```
#### `settings.py`
```python
INSTALLED_APPS+=['django_command_exception']
```
#### `migrate`
```bash
$ python manage.py migrate
```
### Models
model|table|columns/fields
-|-|-
`CommandException`|`django_command_exception`|id,command,exc_class,exc_message,exc_traceback,created_at
### Examples
`call_command`
```python
from django_command_exception.models import CommandException
try:
call_command(name)
except Exception as e:
CommandException(command=name).save()
```
`BaseCommand`
```python
from django_command_exception.models import CommandException
class BaseCommand(BaseCommand):
def execute(self, *args, **options):
try:
return super().execute(*args, **options)
except Exception as e:
CommandException(command=type(self).__module__.split('.')[-1]).save()
```