本文整理匯總了Python中django.conf.settings.__module__方法的典型用法代碼示例。如果您正苦於以下問題:Python settings.__module__方法的具體用法?Python settings.__module__怎麽用?Python settings.__module__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.conf.settings
的用法示例。
在下文中一共展示了settings.__module__方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _init_translation_catalog
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
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()
示例2: all_locale_paths
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
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)
示例3: _init_translation_catalog
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
def _init_translation_catalog(self):
"""Create a base catalog using global django translations."""
settingsfile = sys.modules[settings.__module__].__file__
localedir = os.path.join(os.path.dirname(settingsfile), 'locale')
translation = self._new_gnu_trans(localedir)
self.merge(translation)
示例4: all_locale_paths
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
def all_locale_paths():
"""
Return a list of paths to user-provides languages files.
"""
globalpath = os.path.join(
os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
return [globalpath] + list(settings.LOCALE_PATHS)
示例5: all_locale_paths
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
def all_locale_paths():
"""
Return a list of paths to user-provides languages files.
"""
globalpath = os.path.join(
os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
app_paths = []
for app_config in apps.get_app_configs():
locale_path = os.path.join(app_config.path, 'locale')
if os.path.exists(locale_path):
app_paths.append(locale_path)
return [globalpath] + list(settings.LOCALE_PATHS) + app_paths
示例6: _init_translation_catalog
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
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)
示例7: all_locale_paths
# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import __module__ [as 別名]
def all_locale_paths():
"""
Returns a list of paths to user-provides languages files.
"""
from django.conf import settings
globalpath = os.path.join(
os.path.dirname(upath(sys.modules[settings.__module__].__file__)), 'locale')
return [globalpath] + list(settings.LOCALE_PATHS)