Python django.conf.settings.STATICFILES_STORAGE Examples

The following are 8 code examples for showing how to use django.conf.settings.STATICFILES_STORAGE(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module django.conf.settings , or try the search function .

Example 1
Project: ideascube   Author: ideascube   File: conftest.py    License: GNU Affero General Public License v3.0 6 votes vote down vote up
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') 
Example 2
Project: django-cloudflare-push   Author: skorokithakis   File: middleware.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 
Example 3
Project: GTDWeb   Author: lanbing510   File: storage.py    License: GNU General Public License v2.0 5 votes vote down vote up
def _setup(self):
        self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
Example 4
Project: bioforum   Author: reBiocoder   File: storage.py    License: MIT License 5 votes vote down vote up
def _setup(self):
        self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
Example 5
Project: Hands-On-Application-Development-with-PyCharm   Author: PacktPublishing   File: storage.py    License: MIT License 5 votes vote down vote up
def _setup(self):
        self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
Example 6
Project: openhgsenti   Author: drexly   File: storage.py    License: Apache License 2.0 5 votes vote down vote up
def _setup(self):
        self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
Example 7
Project: python2017   Author: bpgc-cte   File: storage.py    License: MIT License 5 votes vote down vote up
def _setup(self):
        self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)() 
Example 8
Project: django-cloudinary-storage   Author: klis87   File: collectstatic.py    License: MIT License 5 votes vote down vote up
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)