本文整理匯總了Python中django.contrib.staticfiles.finders.FileSystemFinder方法的典型用法代碼示例。如果您正苦於以下問題:Python finders.FileSystemFinder方法的具體用法?Python finders.FileSystemFinder怎麽用?Python finders.FileSystemFinder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.contrib.staticfiles.finders
的用法示例。
在下文中一共展示了finders.FileSystemFinder方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_implementation
# 需要導入模塊: from django.contrib.staticfiles import finders [as 別名]
# 或者: from django.contrib.staticfiles.finders import FileSystemFinder [as 別名]
def get_implementation(action_name):
implementation_path = FileSystemFinder().find(f"bundles/{action_name}.js")
with open(implementation_path) as f:
return f.read()
示例2: __init__
# 需要導入模塊: from django.contrib.staticfiles import finders [as 別名]
# 或者: from django.contrib.staticfiles.finders import FileSystemFinder [as 別名]
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 = {}
示例3: setUp
# 需要導入模塊: from django.contrib.staticfiles import finders [as 別名]
# 或者: from django.contrib.staticfiles.finders import FileSystemFinder [as 別名]
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])
示例4: test_get_finder
# 需要導入模塊: from django.contrib.staticfiles import finders [as 別名]
# 或者: from django.contrib.staticfiles.finders import FileSystemFinder [as 別名]
def test_get_finder(self):
self.assertIsInstance(finders.get_finder(
'django.contrib.staticfiles.finders.FileSystemFinder'),
finders.FileSystemFinder)
示例5: test_cache
# 需要導入模塊: from django.contrib.staticfiles import finders [as 別名]
# 或者: from django.contrib.staticfiles.finders import FileSystemFinder [as 別名]
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)