Python django.contrib.staticfiles.finders.FileSystemFinder() Examples
The following are 5
code examples of django.contrib.staticfiles.finders.FileSystemFinder().
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 also want to check out all available functions/classes of the module
django.contrib.staticfiles.finders
, or try the search function
.
Example #1
Source File: update_actions.py From normandy with Mozilla Public License 2.0 | 5 votes |
def get_implementation(action_name): implementation_path = FileSystemFinder().find(f"bundles/{action_name}.js") with open(implementation_path) as f: return f.read()
Example #2
Source File: finders.py From django-tenants with MIT License | 5 votes |
def __init__(self, app_names=None, *args, **kwargs): # Don't call parent's init method as settings.STATICFILES_DIRS will be loaded # by the standard FileSystemFinder already. # Instead of initializing the locations and storages now, we'll do so lazily # the first time they are needed. self._locations = {} self._storages = {}
Example #3
Source File: test_finders.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def setUp(self): super().setUp() self.finder = finders.FileSystemFinder() test_file_path = os.path.join(TEST_ROOT, 'project', 'documents', 'test', 'file.txt') self.find_first = (os.path.join('test', 'file.txt'), test_file_path) self.find_all = (os.path.join('test', 'file.txt'), [test_file_path])
Example #4
Source File: test_finders.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_get_finder(self): self.assertIsInstance(finders.get_finder( 'django.contrib.staticfiles.finders.FileSystemFinder'), finders.FileSystemFinder)
Example #5
Source File: test_finders.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_cache(self): finders.get_finder.cache_clear() for n in range(10): finders.get_finder('django.contrib.staticfiles.finders.FileSystemFinder') cache_info = finders.get_finder.cache_info() self.assertEqual(cache_info.hits, 9) self.assertEqual(cache_info.currsize, 1)