LOCALE_PATHS should have a check to make sure it's a list/tuple

88 views
Skip to first unread message

Tim Shaffer

unread,
Jun 6, 2014, 11:51:30 AM6/6/14
to django-d...@googlegroups.com
I'm playing around with 1.7b4 and I was trying to track down why my app was not auto-reloading when files were changed using the dev server.

Turns out, it was an improperly configured LOCALE_PATHS setting.

My LOCALE_PATHS was configured like this:

LOCALE_PATHS = (
    '/path/to/locale'
)

At first glance, it looks okay. But it's actually a string and not a tuple since it does not have a comma.

This causes a problem in the autoloader, here:


This would be fine, but since LOCALE_PATHS is a string, calling basedirs.extend(LOCALE_PATHS) actually causes every character in the string to get appended to basedirs. Then it walks through the tree and tries to find .mo files. And since there are 3 slashes in the string, the autoloader attempts to search the root drive 3 times.

Bottom line is that having LOCALE_PATHS set to a string with slashes causes autoreloading to essentially take forever

Maybe adding a warning/validation to ensure LOCALE_PATHS is a list/tuple would be a good idea?

Tim Graham

unread,
Jun 6, 2014, 12:19:52 PM6/6/14
to django-d...@googlegroups.com
Sure, patches welcome. `django.conf.__init__` already has some "tuple_settings" logic which is looks like would probably work for this.
Reply all
Reply to author
Forward
0 new messages