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)