django-discord-integration

Discord integration for Django, supporting error reporting via webhooks.


Keywords
discord, django, error-reporting
Licenses
AGPL-3.0/GPL-3.0+
Install
pip install django-discord-integration==1.2.5

Documentation

Django Discord Integration

Discord integration for Django, supporting error reporting via webhooks.

This app comes with two message handlers: DiscordMessageHandler and SimpleDiscordMessageHandler. DiscordMessageHandler sends all the information related to the message, such as a traceback if there is one, while the SimpleDiscordMessageHandler only sends the title.

Installation

$ pip install django-discord-integration

In your settings.py, add the following:

INSTALLED_APPS = (
    'discord_integration',
    ...
)

Next, migrate the database:

$ python manage.py migrate

Finally, create a Discord integration object in the Django admin site. Set the Discord webhook URL as well as the bot username and avatar URL if necessary. You can create multiple objects to direct different logs to different channels. The default object should the name default.

Sample Logging Configuration

LOGGING = {
    'handlers': {
        'discord_integration': {
            'level': 'ERROR',
            'class': 'discord_integration.log.DiscordMessageHandler',
            'model_name': 'default',  # OPTIONAL: specify a name to use a different integration configuration.
        },
    },
    'loggers': {
        'handlers': ['discord_integration'],
    },
}