我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用django.conf.settings.__module__()。
def _init_translation_catalog(self): """Creates a base catalog using global django translations.""" settingsfile = upath(sys.modules[settings.__module__].__file__) localedir = os.path.join(os.path.dirname(settingsfile), 'locale') translation = self._new_gnu_trans(localedir) self.merge(translation)
def all_locale_paths(): """ Returns a list of paths to user-provides languages files. """ globalpath = os.path.join( os.path.dirname(upath(sys.modules[settings.__module__].__file__)), 'locale') return [globalpath] + list(settings.LOCALE_PATHS)
def _init_translation_catalog(self): """Creates a base catalog using global django translations.""" settingsfile = upath(sys.modules[settings.__module__].__file__) localedir = os.path.join(os.path.dirname(settingsfile), 'locale') use_null_fallback = True if self.__language == settings.LANGUAGE_CODE: # default lang should be present and parseable, if not # gettext will raise an IOError (refs #18192). use_null_fallback = False translation = self._new_gnu_trans(localedir, use_null_fallback) self.plural = translation.plural self._info = translation._info.copy() self._catalog = translation._catalog.copy()