本文整理汇总了Python中django.core.checks.Tags.compatibility方法的典型用法代码示例。如果您正苦于以下问题:Python Tags.compatibility方法的具体用法?Python Tags.compatibility怎么用?Python Tags.compatibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.core.checks.Tags
的用法示例。
在下文中一共展示了Tags.compatibility方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cache_compatibility
# 需要导入模块: from django.core.checks import Tags [as 别名]
# 或者: from django.core.checks.Tags import compatibility [as 别名]
def test_cache_compatibility(self):
compatible_cache = {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
incompatible_cache = {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'cache_table'
}
with self.settings(CACHES={'default': compatible_cache,
'secondary': incompatible_cache}):
errors = run_checks(tags=[Tags.compatibility])
self.assertListEqual(errors, [])
warning001 = Warning(
'Cache backend %r is not supported by django-cachalot.'
% 'django.core.cache.backends.db.DatabaseCache',
hint='Switch to a supported cache backend '
'like Redis or Memcached.',
id='cachalot.W001')
with self.settings(CACHES={'default': incompatible_cache}):
errors = run_checks(tags=[Tags.compatibility])
self.assertListEqual(errors, [warning001])
with self.settings(CACHES={'default': compatible_cache,
'secondary': incompatible_cache},
CACHALOT_CACHE='secondary'):
errors = run_checks(tags=[Tags.compatibility])
self.assertListEqual(errors, [warning001])
示例2: ready
# 需要导入模块: from django.core.checks import Tags [as 别名]
# 或者: from django.core.checks.Tags import compatibility [as 别名]
def ready(self):
@register(Tags.compatibility, Tags.database)
def check_if_postgresql(app_configs, **kwargs):
if get_postgresql_connections():
return []
return [Error('You must use a PostgreSQL database '
'to use PostgreSQL search.',
id='wagtail.contrib.postgres_search.E001')]
set_weights()
from .models import IndexEntry
IndexEntry.add_generic_relations()
示例3: register_checks
# 需要导入模块: from django.core.checks import Tags [as 别名]
# 或者: from django.core.checks.Tags import compatibility [as 别名]
def register_checks():
register(Tags.compatibility)(check_variables)
示例4: ready
# 需要导入模块: from django.core.checks import Tags [as 别名]
# 或者: from django.core.checks.Tags import compatibility [as 别名]
def ready(self):
from django.core.checks import register, Tags
register(django_tus_config_check, Tags.compatibility, deploy=False)