本文整理汇总了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)