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