summaryrefslogtreecommitdiff
path: root/docs/howto
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2011-05-05 20:49:26 +0000
committerLuke Plant <L.Plant.98@cantab.net>2011-05-05 20:49:26 +0000
commit171df93170df23d2fea1f8320ddb80c6f6444ff7 (patch)
treeba9ccc91915ff2d3f76a45994d5f49f4df7d6bce /docs/howto
parentdb5807bdb1f242cc928e2fdf7110cb20af34790f (diff)
Fixed #15954 - New IGNORABLE_404_URLS setting that allows more powerful filtering of 404s to ignore
Thanks to aaugustin for implementing this. (Technically this doesn't fix the original report, as we've decided against having *any* default values, but the new feature makes it possible, and the docs have an example addressing #15954). git-svn-id: http://code.djangoproject.com/svn/django/trunk@16160 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/howto')
-rw-r--r--docs/howto/error-reporting.txt29
1 files changed, 25 insertions, 4 deletions
diff --git a/docs/howto/error-reporting.txt b/docs/howto/error-reporting.txt
index 063f943894..ddef93873e 100644
--- a/docs/howto/error-reporting.txt
+++ b/docs/howto/error-reporting.txt
@@ -66,15 +66,29 @@ a referer. (It doesn't bother to email for 404s that don't have a referer --
those are usually just people typing in broken URLs or broken Web 'bots).
You can tell Django to stop reporting particular 404s by tweaking the
-:setting:`IGNORABLE_404_ENDS` and :setting:`IGNORABLE_404_STARTS` settings. Both
-should be a tuple of strings. For example::
+:setting:`IGNORABLE_404_URLS` setting. It should be a tuple of compiled
+regular expression objects. For example::
- IGNORABLE_404_ENDS = ('.php', '.cgi')
- IGNORABLE_404_STARTS = ('/phpmyadmin/',)
+ import re
+ IGNORABLE_404_URLS = (
+ re.compile(r'\.(php|cgi)$'),
+ re.compile(r'^/phpmyadmin/'),
+ )
In this example, a 404 to any URL ending with ``.php`` or ``.cgi`` will *not* be
reported. Neither will any URL starting with ``/phpmyadmin/``.
+The following example shows how to exclude some conventional URLs that browsers and
+crawlers often request::
+
+ import re
+ IGNORABLE_404_URLS = (
+ re.compile(r'^/apple-touch-icon.*\.png$'),
+ re.compile(r'^/favicon.ico$),
+ re.compile(r'^/robots.txt$),
+ )
+
+
The best way to disable this behavior is to set
:setting:`SEND_BROKEN_LINK_EMAILS` to ``False``.
@@ -93,3 +107,10 @@ The best way to disable this behavior is to set
records are ignored, but you can use them for error reporting by writing a
handler and :doc:`configuring logging </topics/logging>` appropriately.
+.. seealso::
+
+ .. versionchanged:: 1.4
+
+ Previously, two settings were used to control which URLs not to report:
+ :setting:`IGNORABLE_404_STARTS` and :setting:`IGNORABLE_404_ENDS`. They
+ were replaced by :setting:`IGNORABLE_404_URLS`.