{"id":16417542,"url":"https://github.com/valentinogagliardi/django-monitus","last_synced_at":"2025-04-13T17:10:22.345Z","repository":{"id":57420942,"uuid":"322930085","full_name":"valentinogagliardi/django-monitus","owner":"valentinogagliardi","description":"HTTP error reporting middleware(s) for Django","archived":false,"fork":false,"pushed_at":"2020-12-28T11:05:17.000Z","size":37,"stargazers_count":17,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T07:51:35.777Z","etag":null,"topics":["asynchronous","asynchronous-django","django","django-middleware","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/django-monitus/","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/valentinogagliardi.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2020-12-19T20:14:05.000Z","updated_at":"2025-01-12T18:59:28.000Z","dependencies_parsed_at":"2022-09-01T04:50:48.315Z","dependency_job_id":null,"html_url":"https://github.com/valentinogagliardi/django-monitus","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinogagliardi%2Fdjango-monitus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinogagliardi%2Fdjango-monitus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinogagliardi%2Fdjango-monitus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valentinogagliardi%2Fdjango-monitus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valentinogagliardi","download_url":"https://codeload.github.com/valentinogagliardi/django-monitus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750107,"owners_count":21155686,"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":["asynchronous","asynchronous-django","django","django-middleware","python"],"created_at":"2024-10-11T07:11:34.125Z","updated_at":"2025-04-13T17:10:22.321Z","avatar_url":"https://github.com/valentinogagliardi.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"===================\ndjango-monitus\n===================\n\n.. image:: https://img.shields.io/twitter/follow/gagliardi_vale?style=social\n   :target: https://twitter.com/gagliardi_vale\n\n.. image:: https://github.com/valentinogagliardi/django-monitus/workflows/Tox%20tests/badge.svg\n   :target: https://github.com/valentinogagliardi/django-monitus/actions\n\nTiny error reporting middleware(s) for Django. Includes the following middlewares:\n\n- ``Error403EmailsMiddleware``: sends an email to ``ADMINS`` on 403.\n- ``FailedLoginMiddleware``: sends an email to ``ADMINS`` on failed logins.\n\nRequirements\n------------\n\nTested on Python 3.8.\n\nTested on Django 3.0 and 3.1.\n\nSetup\n------------\nInstall from pip:\n\n.. code-block:: sh\n\n    python -m pip install django-monitus\n\nThen add it to the list of installed apps:\n\n.. code-block:: python\n\n    INSTALLED_APPS = [\n    ...\n    \"monitus\"\n    ...\n    ]\n\nEnable the desired middleware:\n\n.. code-block:: python\n\n    MIDDLEWARE = [\n    ...\n    \"monitus.middleware.Error403EmailsMiddleware\"\n    ...\n    ]\n\nSetup ``ADMINS`` in your settings:\n\n.. code-block:: python\n\n    MANAGERS = [(\"Juliana C.\", \"juliana.crain@dev.io\")]\n\nUsage with asynchronous Django\n------------------------------\n\nAs of now only ``Error403EmailsMiddleware`` can run asynchronously under ASGI. If you plan to use ``FailedLoginMiddleware`` and ``Error403EmailsMiddleware`` together make sure to place ``Error403EmailsMiddleware`` **before** (reading top to bottom) ``FailedLoginMiddleware``:\n\n.. code-block:: python\n\n    MIDDLEWARE = [\n    \"monitus.middleware.FailedLoginMiddleware\",\n    \"monitus.middleware.Error403EmailsMiddleware\" # this should go before FailedLoginMiddleware\n    ...\n    ]\n\nThis way the async chain doesn't get broken when the response traverses the middleware chain to exit out to the user.\n\nDevelopment and testing\n-----------------------\n\nTo test on your local machine with Postgres, make sure to have a role with enough privileges:\n\n.. code-block:: bash\n\n    CREATE ROLE monitustestuser WITH LOGIN PASSWORD 'monitustestpassword' CREATEDB;\n\nThen run\n\n.. code-block:: bash\n\n    DATABASE_URL=postgres://monitustestuser:monitustestpassword@localhost/monitustestdb tox","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinogagliardi%2Fdjango-monitus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinogagliardi%2Fdjango-monitus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinogagliardi%2Fdjango-monitus/lists"}