{"id":20754373,"url":"https://github.com/venhance/evans_django_tools","last_synced_at":"2026-04-21T10:02:27.896Z","repository":{"id":63273618,"uuid":"402903546","full_name":"vEnhance/evans_django_tools","owner":"vEnhance","description":"Discord logging and unit test components for Django","archived":false,"fork":false,"pushed_at":"2025-03-06T23:19:04.000Z","size":123,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-06T22:59:47.105Z","etag":null,"topics":["discord","logging","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vEnhance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-03T21:39:14.000Z","updated_at":"2025-03-06T23:19:08.000Z","dependencies_parsed_at":"2024-01-04T20:43:53.602Z","dependency_job_id":"e85866a6-1410-4909-86d3-36e7d9e82ee6","html_url":"https://github.com/vEnhance/evans_django_tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vEnhance/evans_django_tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vEnhance%2Fevans_django_tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vEnhance%2Fevans_django_tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vEnhance%2Fevans_django_tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vEnhance%2Fevans_django_tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vEnhance","download_url":"https://codeload.github.com/vEnhance/evans_django_tools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vEnhance%2Fevans_django_tools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264821944,"owners_count":23669301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","logging","python"],"created_at":"2024-11-17T09:17:18.008Z","updated_at":"2026-04-21T10:02:27.870Z","avatar_url":"https://github.com/vEnhance.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# evans_django_tools\n\nThis repository is now archived because its functionality has been split off.\n\n- [Testing shortcuts were moved into a separate file](https://github.com/vEnhance/otis-web/blob/main/otisweb_testsuite/testcase.py).\n- [Discord webhooks were split off](https://github.com/vEnhance/django-discordo)\n- CI is now usually done via [Makefile](https://github.com/vEnhance/otis-web/blob/main/Makefile)\n  for a simpler [ci.yml](https://github.com/vEnhance/otis-web/blob/main/.github/workflows/ci.yml).\n\n## Old description\n\nThis is a submodule containing a bunch of stuff that I use between multiple\nDjango projects.\nThings here were originally written for use with\n[OTIS-WEB](https://github.com/vEnhance/otis-web),\nbut I then found myself copy-pasting this code in other\nPython web applications I was writing. Hence this repository.\n\n(Right now, I am assuming I am the sole user of this package.\nIf any person other than me expresses interest in using this,\nopen an issue, and I will (eventually) submit it to PyPi.)\n\n## Discord webhook handler\n\nThis is a wrapper script that implements a handler\nfor logging commands to send Discord webhooks.\nFor web applications running Django, it will additionally\nprovide some `request` information in the webhook embed.\n\n1. This package needs the `requests` and `python-dotenv` packages.\n2. Add this repository as a submodule of your project.\n3. Import it using `from evans_django_tools import DiscordWebhookHandler`.\n4. Add standard `logging` commands. For example,\n\n   ```python\n   import logging\n   from evans_django_tools import DiscordWebhookHandler\n\n   logger = logging.getLogger('root')\n   logger.setLevel(logging.INFO)\n   logger.addHandler(DiscordWebhookHandler())\n   logger.addHandler(logging.StreamHandler())\n   ```\n\n5. You should set environment variable `WEBHOOK_URL` to the target webhook URL.\n6. If you want different channels for different error levels,\n   use `WEBHOOK_CRITICAL_URL`, `WEBHOOK_ERROR_URL`, etc.\n   Otherwise `WEBHOOK_URL` is used by default.\n7. The package adds three new log levels: `VERBOSE_LOG_LEVEL = 15`,\n   `SUCCESS_LOG_LEVEL = 25`, `ACTION_LOG_LEVEL = 35`.\n\n## Test suite\n\nThe file `evans_django_tools/testsuite.py` has a bunch of homemade helper\nfunctions for writing Django tests.\n\n## Bash scripts for local checks\n\nTo use the `lint.sh` automatically on `git push`, create an executable file\n`.git/hooks/pre-push` with content `./evans_django_tools/lint.sh`.\nThis will run the `lint.sh` script automatically before pushing anything (and\nabort the push if any issues are detected).\n\nRunning `./evans_django_tools/bypass-lint.sh` causes\n`./evans_django_tools/lint.sh` to do nothing for the current commit, hence the\nname.\n\n## GitHub workflow\n\nThis repository has a Github reusable workflow that you can use that runs\nessentially the same checks as `lint.sh`. To use it, create\n`.github/workflows/django-audit.yml` in your main repository and include\nsomething like the following:\n\n```yaml\nname: Django Audit\n\non:\n  push:\n    branches: [\"*\"]\n  pull_request:\n    branches: [\"*\"]\njobs:\n  audit:\n    uses: vEnhance/evans_django_tools/.github/workflows/django-audit.yml@main\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvenhance%2Fevans_django_tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvenhance%2Fevans_django_tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvenhance%2Fevans_django_tools/lists"}