本文整理匯總了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')
示例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
示例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)()
示例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)