本文整理汇总了Python中app.models.Image.drop_collection方法的典型用法代码示例。如果您正苦于以下问题:Python Image.drop_collection方法的具体用法?Python Image.drop_collection怎么用?Python Image.drop_collection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.models.Image
的用法示例。
在下文中一共展示了Image.drop_collection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from app.models import Image [as 别名]
# 或者: from app.models.Image import drop_collection [as 别名]
def run(self):
"""Run the generation. Uses the configurations passed to
func:`__init__`.
"""
# Setup: db connection, superuser, and printer.
connect(config['MONGODB_SETTINGS']['DB'])
try:
superuser = User.objects().get(gplus_id='super')
except DoesNotExist:
print ('Failed to get superuser. Try running:\n'
'\texport GOOGLE_AUTH_ENABLED=TRUE')
printer = ProgressPrinter(self.quiet)
# Images
if self.should_gen_images:
if self.wipe:
self.warn('Image')
print CLIColor.warning('Wiping Image database.')
Image.drop_collection()
create_images(12, superuser, printer)
# Blog posts
if self.should_gen_posts:
if self.wipe:
self.warn('BlogPost')
print CLIColor.warning('Wiping BlogPost database.')
BlogPost.drop_collection()
create_posts(10, superuser, printer)
# Events and event series
if self.should_gen_events:
if self.wipe:
self.warn('Event and EventSeries')
print CLIColor.warning('Wiping Event database.')
Event.drop_collection()
print CLIColor.warning('Wiping EventSeries database.')
EventSeries.drop_collection()
create_events(superuser, printer)