[1.6.x] Fixed #21530 -- Prevent AttributeError in default URLconf detection code.

Thanks to @dmyerscoug for the report and original patch
and to @alasdairnicol for the added tests.

Backport of a020dd0a99da13d0f024d42c46f01d8f503e9d5e from master.
[1.6.x] Added fix for #21530 to 1.6.1 release notes.

Backport of 19b22d4f0e0eafec1aafb9489f0830ae572b5db5 from master.