当前位置: 首页>>代码示例>>Python>>正文


Python values.Value方法代码示例

本文整理汇总了Python中configurations.values.Value方法的典型用法代码示例。如果您正苦于以下问题:Python values.Value方法的具体用法?Python values.Value怎么用?Python values.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configurations.values的用法示例。


在下文中一共展示了values.Value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RAVEN_CONFIG

# 需要导入模块: from configurations import values [as 别名]
# 或者: from configurations.values import Value [as 别名]
def RAVEN_CONFIG(self):
        version_path = os.path.join(Core.BASE_DIR, "version.json")
        try:
            with open(version_path) as f:
                build_info = json.loads(f.read())
                version = build_info.get("version")
        except IOError:
            version = None

        return {
            "dsn": values.URLValue(None, environ_name="RAVEN_CONFIG_DSN"),
            "release": values.Value(version, environ_name="RAVEN_CONFIG_RELEASE"),
        }

    # statsd 
开发者ID:mozilla,项目名称:normandy,代码行数:17,代码来源:settings.py

示例2: post_setup

# 需要导入模块: from configurations import values [as 别名]
# 或者: from configurations.values import Value [as 别名]
def post_setup(cls):
        super().post_setup()
        # in case we don't find these AWS config variables in the environment
        # we load them from the .env file
        for param in ("ACCESS_KEY_ID", "SECRET_ACCESS_KEY", "DEFAULT_REGION"):
            if param not in os.environ:
                os.environ[param] = values.Value(
                    default="", environ_name=param, environ_prefix="AWS"
                ) 
开发者ID:mozilla,项目名称:telemetry-analysis-service,代码行数:11,代码来源:settings.py

示例3: post_setup

# 需要导入模块: from configurations import values [as 别名]
# 或者: from configurations.values import Value [as 别名]
def post_setup(cls):
        """Check database setup after settings are loaded"""
        # super(Base, cls).post_setup()

        if cls.DATABASES['default']['ENGINE'] == 'django.db.backends.mysql':
            # Force strict mode (MySQL only)
            # https://stackoverflow.com/questions/23022858/force-strict-sql-mode-in-django
            if 'OPTIONS' not in cls.DATABASES['default']:
                cls.DATABASES['default']['OPTIONS'] = {}

            cls.DATABASES['default']['OPTIONS']['sql_mode'] = 'traditional'
            # TODO Check this to handle "Incorrect string value" db error
            # cls.DATABASES['default']['OPTIONS']['charset'] = 'utf8mb4'

            cls.DATABASE_MYSQL = True
        else:
            cls.DATABASE_MYSQL = False

        # Disable cache
        if cls.DEBUG and cls.CACHE_DISABLE:
            cls.CACHES['default']['BACKEND'] = 'django.core.cache.backends.dummy.DummyCache'

        # Overwrite log filename
        log_file = values.Value(default=None, environ_name='LOG_FILE')

        if 'handlers' in cls.LOGGING and 'logfile' in cls.LOGGING['handlers'] and log_file:
            cls.LOGGING['handlers']['logfile']['filename'] = os.path.join(cls.BASE_DIR, 'logs', log_file) 
开发者ID:openlegaldata,项目名称:oldp,代码行数:29,代码来源:settings.py


注:本文中的configurations.values.Value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。