def forge(category, post, comment): """ 生成虚拟数据 :param category: :param post: :param comment: :return: """ from myblog.fakes import fake_admin, fake_categories, fake_posts, fake_comments, fake_links db.drop_all() db.create_all() click.echo('Generating the administrator...') fake_admin() click.echo('Generating %d categories...' % category) fake_categories(category) click.echo('Generating %d posts...' % post) fake_posts(post) click.echo('Generating %d comments...' % comment) fake_comments(comment) click.echo('Generating links...') fake_links() click.echo('Done.')
def forge(category, post, comment): """Generates the fake categories, posts, comments and links.""" from myblog.fakes import ( fake_admin, fake_categories, fake_posts, fake_comments, fake_links, ) db.drop_all() db.create_all() click.echo("Generating the administrator...") fake_admin() click.echo("Generating %d categories..." % category) fake_categories(category) click.echo("Generating %d posts..." % post) fake_posts(post) click.echo("Generating %d comments..." % comment) fake_comments(comment) click.echo("Generating links...") fake_links() click.echo("Done.")
def forge(category, post, comment): from myblog.fakes import fake_posts, fake_comments, fake_categories, fake_admin, fake_links db.drop_all() db.create_all() click.echo('Generating the administrator...') fake_admin() click.echo("Generating %d categories..." % category) fake_categories(category) click.echo("Generating %d posts" % post) fake_posts(post) click.echo('Generating %d comments' % comment) fake_comments(comment) click.echo("Generating links") fake_links() click.echo("ok")
def forge(category, post, comment): from myblog.fakes import fake_admin, faker_categoryies, fake_posts, fake_comments, fake_links db.drop_all() db.create_all() click.echo('Generating the administrator...') fake_admin() click.echo('Generating {} categories...'.format(category)) faker_categoryies(category) click.echo('Generating %d posts...' % post) fake_posts(post) click.echo('Generating %d comments...' % comment) fake_comments(comment) click.echo('Generating links...') fake_links() click.echo('Done.')
def forge(category, post, comment): """生成虚假数据。""" from myblog.fakes import fake_admin, fake_categories, fake_posts, fake_comments, fake_links db.drop_all() db.create_all() click.echo('生成管理员...') fake_admin() click.echo('生成 %d 个分类...' % category) fake_categories(category) # 这里的category代表数量,下同 click.echo('生成 %d 篇文章...' % post) fake_posts(post) click.echo('生成 %d 条评论...' % comment) fake_comments(comment) click.echo('生成分享链接...') fake_links() click.echo('完成')