Django's IGNORABLE_404_ENDS ... what am I missing?
So I'm late to the party here, but I just came acro开发者_开发技巧ss IGNORABLE_404_STARTS and IGNORABLE_404_ENDS. I'm trying to make use of this, but it isn't working for me. For instance, I set:
IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi','favicon.ico', '.php')
If I go to http://www.mysite.com/test/mail.cgi, I will still get the 404 error message emailed to the admin account. Am I missing something here? My reading of the docs led me to believe that this case wouldn't generate an email.
Is that line of code copied directly from your project? I ask because IGNORABLE_404_ENDS
requires a iterable object, so if you accidentally set it to:
IGNORABLE_404_ENDS = ('mail.cgi')
(or, in other words, a string, not a tuple -- note the lack of a common before the file parenthesis) then IGNORABLE_404_ENDS
will actually be equivalent to:
IGNORABLE_404_ENDS = ('m', 'a', 'i', 'l', '.', 'c', 'g', 'i')
and thus won't work as expected.
I only bring this up because I've made this mistake before.
精彩评论