本文整理匯總了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)