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


Python settings.STATICFILES_STORAGE屬性代碼示例

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


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

示例1: pytest_configure

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import STATICFILES_STORAGE [as 別名]
def pytest_configure(config):
    from django.conf import settings

    # This is already supposed to be the case by default, and we even tried
    # setting it explicitly anyway.
    #
    # But somehow, at the very beginning of the test suite (when running the
    # migrations or when the post_migrate signal is fired), the transient
    # database is on the filesystem (the value of NAME).
    #
    # We can't figure out why that is, it might be a bug in pytest-django, or
    # worse in django itself.
    #
    # Somehow the default database is always in memory, though.
    settings.DATABASES['transient']['TEST_NAME'] = ':memory:'

    # The documentation says not to use the ManifestStaticFilesStorage for
    # tests, and indeed if we do they fail.
    settings.STATICFILES_STORAGE = (
        'django.contrib.staticfiles.storage.StaticFilesStorage') 
開發者ID:ideascube,項目名稱:ideascube,代碼行數:22,代碼來源:conftest.py

示例2: storage_factory

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import STATICFILES_STORAGE [as 別名]
def storage_factory(collector):
    class DebugConfiguredStorage(LazyObject):
        def _setup(self):
            configured_storage_cls = get_storage_class(settings.STATICFILES_STORAGE)

            class DebugStaticFilesStorage(configured_storage_cls):

                def __init__(self, collector, *args, **kwargs):
                    super(DebugStaticFilesStorage, self).__init__(*args, **kwargs)
                    self.collector = collector

                def url(self, path):
                    self.collector.collect(path)
                    return super(DebugStaticFilesStorage, self).url(path)

            self._wrapped = DebugStaticFilesStorage(collector)
    return DebugConfiguredStorage 
開發者ID:skorokithakis,項目名稱:django-cloudflare-push,代碼行數:19,代碼來源:middleware.py

示例3: _setup

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import STATICFILES_STORAGE [as 別名]
def _setup(self):
        self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:4,代碼來源:storage.py

示例4: copy_file

# 需要導入模塊: from django.conf import settings [as 別名]
# 或者: from django.conf.settings import STATICFILES_STORAGE [as 別名]
def copy_file(self, path, prefixed_path, source_storage):
        """
        Overwritten to execute only with --upload-unhashed-files param or StaticCloudinaryStorage.
        Otherwise only hashed files will be uploaded during postprocessing.
        """
        if (settings.STATICFILES_STORAGE == 'cloudinary_storage.storage.StaticCloudinaryStorage' or
                self.upload_unhashed_files):
            super(Command, self).copy_file(path, prefixed_path, source_storage) 
開發者ID:klis87,項目名稱:django-cloudinary-storage,代碼行數:10,代碼來源:collectstatic.py


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