本文整理汇总了Python中django.contrib.staticfiles.management.commands.collectstatic.Command.set_options方法的典型用法代码示例。如果您正苦于以下问题:Python Command.set_options方法的具体用法?Python Command.set_options怎么用?Python Command.set_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.staticfiles.management.commands.collectstatic.Command
的用法示例。
在下文中一共展示了Command.set_options方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_post_processing
# 需要导入模块: from django.contrib.staticfiles.management.commands.collectstatic import Command [as 别名]
# 或者: from django.contrib.staticfiles.management.commands.collectstatic.Command import set_options [as 别名]
def test_post_processing(self):
"""Test that post_processing behaves correctly.
Files that are alterable should always be post-processed; files that
aren't should be skipped.
collectstatic has already been called once in setUp() for this testcase,
therefore we check by verifying behavior on a second run.
"""
collectstatic_args = {
'interactive': False,
'verbosity': '0',
'link': False,
'clear': False,
'dry_run': False,
'post_process': True,
'use_default_ignore_patterns': True,
'ignore_patterns': ['*.ignoreme'],
}
collectstatic_cmd = CollectstaticCommand()
collectstatic_cmd.set_options(**collectstatic_args)
stats = collectstatic_cmd.collect()
self.assertIn(os.path.join('cached', 'css', 'window.css'), stats['post_processed'])
self.assertIn(os.path.join('cached', 'css', 'img', 'window.png'), stats['unmodified'])
self.assertIn(os.path.join('test', 'nonascii.css'), stats['post_processed'])
示例2: test_post_processing
# 需要导入模块: from django.contrib.staticfiles.management.commands.collectstatic import Command [as 别名]
# 或者: from django.contrib.staticfiles.management.commands.collectstatic.Command import set_options [as 别名]
def test_post_processing(self):
"""
Test that post_processing behaves correctly.
Files that are alterable should always be post-processed; files that
aren't should be skipped.
collectstatic has already been called once in setUp() for this testcase,
therefore we check by verifying behavior on a second run.
"""
collectstatic_args = {
"interactive": False,
"verbosity": 0,
"link": False,
"clear": False,
"dry_run": False,
"post_process": True,
"use_default_ignore_patterns": True,
"ignore_patterns": ["*.ignoreme"],
}
collectstatic_cmd = CollectstaticCommand()
collectstatic_cmd.set_options(**collectstatic_args)
stats = collectstatic_cmd.collect()
self.assertIn(os.path.join("cached", "css", "window.css"), stats["post_processed"])
self.assertIn(os.path.join("cached", "css", "img", "window.png"), stats["unmodified"])
self.assertIn(os.path.join("test", "nonascii.css"), stats["post_processed"])
示例3: collect
# 需要导入模块: from django.contrib.staticfiles.management.commands.collectstatic import Command [as 别名]
# 或者: from django.contrib.staticfiles.management.commands.collectstatic.Command import set_options [as 别名]
def collect(self):
collectstatic_cmd = CollectstaticCommand()
collectstatic_cmd.set_options(**COLLECTSTATIC_ARGS)
return collectstatic_cmd.collect()