{"id":16417456,"url":"https://github.com/mherrmann/django-404-middleware","last_synced_at":"2025-10-07T08:32:44.974Z","repository":{"id":57418768,"uuid":"174950136","full_name":"mherrmann/django-404-middleware","owner":"mherrmann","description":"An alternative to Django's BrokenLinkEmailsMiddleware","archived":false,"fork":false,"pushed_at":"2020-03-25T06:02:51.000Z","size":24,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T09:39:15.409Z","etag":null,"topics":["django","python","python3"],"latest_commit_sha":null,"homepage":null,"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/mherrmann.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}},"created_at":"2019-03-11T07:45:57.000Z","updated_at":"2024-07-30T16:14:20.000Z","dependencies_parsed_at":"2022-09-13T13:20:27.243Z","dependency_job_id":null,"html_url":"https://github.com/mherrmann/django-404-middleware","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mherrmann%2Fdjango-404-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mherrmann%2Fdjango-404-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mherrmann%2Fdjango-404-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mherrmann%2Fdjango-404-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mherrmann","download_url":"https://codeload.github.com/mherrmann/django-404-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235607559,"owners_count":19017378,"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":["django","python","python3"],"created_at":"2024-10-11T07:11:31.204Z","updated_at":"2025-10-07T08:32:39.641Z","avatar_url":"https://github.com/mherrmann.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Django 404 Middleware\nDjango's\n[BrokenLinkEmailsMiddleware](https://docs.djangoproject.com/en/2.1/howto/error-reporting/#errors)\ncan email you about broken links on your site:\n\n```\nBroken link on mysite.com\n=========================\nReferrer: https://www.google.com\nRequested URL: /nonexistent\nUser agent: Mozilla/5.0 (...)\nIP address: 1.2.3.4\n```\n\nThe problem is, these emails often contain false positives. To tell Django to\nignore particular broken links, you need to change the setting\n`IGNORABLE_404_URLS`. This quickly becomes tedious.\n\nThis library is a drop-in replacement for `BrokenLinkEmailsMiddleware`. It sends\nthe same emails, but is configured via the database (and Django's Admin\ninterface) instead of a setting. This makes it much easier to mark URLs as\nignorable.\n\nWhen a broken URL is encountered, this library adds a link to the bottom of the\n404 email:\n\n```\nBroken link on mysite.com\n=========================\n...\n\nTo ignore this link, visit mysite.com/admin/...\n```\n\nClicking on the link opens Django's Admin interface with a pre-filled form for\nignoring the 404:\n\n![Add](Screenshot.png?raw=true \"Optional Title\")\n\nJust click _Save_ to never be notified of this particular false positive again.\n\n## Installation\n\nInstall this library via:\n\n    pip install django-404-middleware\n\nAdd it to the `INSTALLED_APPS` in your Django settings file:\n\n```\nINSTALLED_APPS = [\n    ...,\n    'django_404_middleware'\n]\n```\n\nAlso add it to your `MIDDLEWARE` setting. Typically, you would already have an\nentry `django.middleware.common.BrokenLinkEmailsMiddleware`. Replace it by the\nfollowing:\n\n```\nMIDDLEWARE = [\n    ...,\n    'django_404_middleware.BrokenLinkEmailsDbMiddleware',\n    ...\n]\n```\n\n(Note that if you are using Django \u003c 2, the setting is called\n`MIDDLEWARE_CLASSES`, not `MIDDLEWARE`.)\n\nThe same caveat as for Django's built-in 404 middleware applies:\n`BrokenLinkEmailsDbMiddleware` must appear before other middleware that\nintercepts 404 errors. Put it towards the top of your `MIDDLEWARE` setting.\n\nFinally, apply migrations to initialise the database:\n\n    python manage.py migrate\n\n## Caveats\n\nThe current implementation is not optimized for performance in any way.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmherrmann%2Fdjango-404-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmherrmann%2Fdjango-404-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmherrmann%2Fdjango-404-middleware/lists"}