get the value under the settings.__module__ key of the sys.modules dictionary, use its __file__ field as an argument,
globalpath = os . path . join ( os . path . dirname ( upath ( sys . modules [ settings . __module__ ] . __file__ ) ) , 'locale' )