當前位置: 首頁>>代碼示例>>Python>>正文


Python constants.DEBUG屬性代碼示例

本文整理匯總了Python中django.contrib.messages.constants.DEBUG屬性的典型用法代碼示例。如果您正苦於以下問題:Python constants.DEBUG屬性的具體用法?Python constants.DEBUG怎麽用?Python constants.DEBUG使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在django.contrib.messages.constants的用法示例。


在下文中一共展示了constants.DEBUG屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: dump_config

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def dump_config() -> None:
    """Print the configuration in the console."""
    print('ALLOWED_HOSTS:', ALLOWED_HOSTS)
    print('BASE_DIR:', BASE_DIR())
    print('CELERY_TASK_ALWAYS_EAGER:', CELERY_TASK_ALWAYS_EAGER)
    print('DATABASE_URL:', DATABASES['default'])
    print('DEBUG:', DEBUG)
    print('DOMAIN_NAME:', DOMAIN_NAME)
    print('MEDIA_ROOT:', MEDIA_ROOT)
    print('MEDIA_URL:', MEDIA_URL)
    print('ONTASK_HELP_URL:', ONTASK_HELP_URL)
    print('ONTASK_TESTING:', ONTASK_TESTING)
    print('REDIS_URL:', REDIS_URL)
    print('STATICFILES_DIRS:', ', '.join(STATICFILES_DIRS))
    print('STATIC_ROOT:', STATIC_ROOT)
    print('STATIC_URL:', STATIC_URL)
    print('USE_SSL:', USE_SSL) 
開發者ID:abelardopardo,項目名稱:ontask_b,代碼行數:19,代碼來源:base.py

示例2: debug

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def debug(request, message, extra_tags='', fail_silently=False):
    """
    Adds a message with the ``DEBUG`` level.
    """
    add_message(request, constants.DEBUG, message, extra_tags=extra_tags,
                fail_silently=fail_silently) 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:8,代碼來源:api.py

示例3: debug

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def debug(request, message, extra_tags='', fail_silently=False):
    """Add a message with the ``DEBUG`` level."""
    add_message(request, constants.DEBUG, message, extra_tags=extra_tags,
                fail_silently=fail_silently) 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:6,代碼來源:api.py

示例4: debug

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def debug(user, message):
    """
    Adds a message with the ``DEBUG`` level.

    :param user: User instance
    :param message: Message to show
    """
    message_user(user, message, constants.DEBUG) 
開發者ID:Inboxen,項目名稱:Inboxen,代碼行數:10,代碼來源:messages.py

示例5: add_level_messages

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def add_level_messages(storage):
    """
    Add 6 messages from different levels (including a custom one) to a storage
    instance.
    """
    storage.add(constants.INFO, 'A generic info message')
    storage.add(29, 'Some custom level')
    storage.add(constants.DEBUG, 'A debugging message', extra_tags='extra-tag')
    storage.add(constants.WARNING, 'A warning')
    storage.add(constants.ERROR, 'An error')
    storage.add(constants.SUCCESS, 'This was a triumph.') 
開發者ID:nesdis,項目名稱:djongo,代碼行數:13,代碼來源:base.py

示例6: test_safedata

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def test_safedata(self):
        """
        A message containing SafeData is keeping its safe status when
        retrieved from the message storage.
        """
        def encode_decode(data):
            message = Message(constants.DEBUG, data)
            encoded = storage._encode(message)
            decoded = storage._decode(encoded)
            return decoded.message

        storage = self.get_storage()
        self.assertIsInstance(encode_decode(mark_safe("<b>Hello Django!</b>")), SafeData)
        self.assertNotIsInstance(encode_decode("<b>Hello Django!</b>"), SafeData) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:16,代碼來源:test_cookie.py

示例7: test_safedata

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def test_safedata(self):
        """
        A message containing SafeData keeps its safe status when retrieved from
        the message storage.
        """
        storage = self.get_storage()
        message = Message(constants.DEBUG, mark_safe("<b>Hello Django!</b>"))
        set_session_data(storage, [message])
        self.assertIsInstance(list(storage)[0].message, SafeData) 
開發者ID:nesdis,項目名稱:djongo,代碼行數:11,代碼來源:test_session.py

示例8: debug

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def debug(self, msg):
        self.add_message(constants.DEBUG, msg) 
開發者ID:erigones,項目名稱:esdc-ce,代碼行數:4,代碼來源:utils.py

示例9: debug

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def debug(request, message, extra_tags='', fail_silently=False):
    """Adds a message with the ``DEBUG`` level."""
    add_message(request, constants.DEBUG, message, extra_tags=extra_tags,
                fail_silently=fail_silently) 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:6,代碼來源:messages.py

示例10: level_to_bootstrap

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [as 別名]
def level_to_bootstrap(message):
    map = {
        constants.DEBUG: 'alert-info',
        constants.INFO: 'alert-info',
        constants.SUCCESS: 'alert-success',
        constants.WARNING: 'alert-warning',
        constants.ERROR: 'alert-danger',
    }
    return map.get(message.level, 'alert-info') 
開發者ID:CroceRossaItaliana,項目名稱:jorvik,代碼行數:11,代碼來源:base_tags.py

示例11: post_setup

# 需要導入模塊: from django.contrib.messages import constants [as 別名]
# 或者: from django.contrib.messages.constants import DEBUG [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


注:本文中的django.contrib.messages.constants.DEBUG屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。