开发者

Django's IGNORABLE_404_ENDS ... what am I missing?

开发者 https://www.devze.com 2022-12-19 20:41 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消