Exception Logger with AI Suggestions for Django
Project description
ExceptBot: Django Exception Logger with AI Suggestions for Fixing
Imagine: An exception is thrown on your site and it is critical.
You need a solution fast.
ExceptBot is a Django middleware application that captures and logs exceptions that occur within your Django project. Site admins can quickly view exceptions, the code where the problem originated, and with a button-click feed all that info to ChatGPT to get a possible solution.
Features
- Automatically logs exceptions, including:
- The Python Code and line where the exception occurred
- The full stack trace
- URL path, Exception type, timestamp, user (if authenticated)
- Gets AI Suggestions
- Sends all relevant info to ChatGPT API:
- Stack trace
- Source code producing the exception
- line causing the exception
- Sends all relevant info to ChatGPT API:
- Superuser-restricted views to:
- View a list of unresolved exceptions
- Mark exceptions as resolved
- View detailed information for each exception
- Tracks which superuser resolved an exception and when
Installation
- Install the ExceptBot library
pip3 install exceptbot
- Add 'ExceptBot' to INSTALLED_APPS in your project's
settings.py
:
INSTALLED_APPS = [
# ...
'exceptbot',
# ...
]
- Include the middleware in the MIDDLEWARE list in your
settings.py
:
MIDDLEWARE = [
# ...
'exceptbot.middleware.ExceptBotMiddleware',
# ...
]
- Include the ExceptBot URLs in your project's
urls.py
:
from django.urls import path, include
urlpatterns = [
# ...
path('exceptbot/', include('exceptbot.urls')),
# ...
]
Run migrations to create the necessary database tables and set up static files
$ python3 manage.py makemigrations exceptbot
$ python3 manage.py migrate exceptbot
$ python3 manage.py collectstatic --no-input
Usage
Once integrated into your Django project:
- setup the Chat GPT connection (When you have an account, your API key is here)
- Any exception that occurs will be automatically logged by the middleware.
- Superusers can navigate to
/exceptbot/
to view a list of unresolved exceptions. - Click on an exception to view its detailed information.
- Superusers can mark exceptions as resolved, which will also record who resolved it and when.
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
exceptbot-1.0.9.tar.gz
(283.3 kB
view hashes)
Built Distribution
exceptbot-1.0.9-py3-none-any.whl
(286.1 kB
view hashes)
Close
Hashes for exceptbot-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fef4d1c9348f763404a547131031f837c3de8d71d073848b1fb48a9c1d3c84a |
|
MD5 | 8c57802d0bd88d66b806d9c755d685fd |
|
BLAKE2b-256 | 9704d573f0dc4388979180b086386f2e5ea36f4de6cdc137ee827071e7aa0979 |