[1.7.x] Fixed #23717 -- Fixed makemessages crash when STATIC_ROOT=None

Backport of 528c9af54 from master.