Beispiel #1
0
    def forge(category, post, comment):
        """Generate fake data."""
        from myblog.fakes import fake_admin, fake_categories, fake_posts, fake_comments

        db.drop_all()
        db.create_all()

        click.echo('正在创建管理员...')
        fake_admin()

        click.echo('正在创建 %d 个分类...' % category)
        fake_categories(category)

        click.echo('正在创建 %d 篇文章...' % post)
        fake_posts(post)

        click.echo('正在创建 %d 条评论...' % comment)
        fake_comments(comment)

        # click.echo('正在创建 %d 条二级评论...' % comment)
        # comments = Comment.query.all()
        # for comment in comments:
        #     fake_sub_comments(comment)

        click.echo('已完成')
Beispiel #2
0
    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.')
Beispiel #3
0
    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.")
Beispiel #4
0
 def forge(category, post, comment):
     '''Generates the fake categories, posts and comments.'''
     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('done.')
Beispiel #5
0
    def forge(category, post, comment):
        from myblog.fakes import fake_admin, fake_categories, fake_comments, fake_posts
        db.drop_all()
        db.create_all()

        click.echo("生成管理员")
        fake_admin()

        click.echo("生成分类")
        fake_categories()

        click.echo("生成博文")
        fake_posts(post)

        click.echo("生成评论")
        fake_comments(comment)

        click.echo("生成完成")
Beispiel #6
0
    def forge(category, post, tag, comment):
        """Generate fake data."""
        from myblog.fakes import  fake_categories, fake_posts, fake_tags, fake_comments, fake_default

        db.drop_all()
        db.create_all()
        fake_default()
        click.echo('Generating %d categories...' % category)
        fake_categories(category)

        click.echo('Generating Tags...')
        fake_tags(tag)

        click.echo('Generating %d posts...' % post)
        fake_posts(post)

        fake_comments(comment)

        click.echo('Done.')
Beispiel #7
0
    def forge(category, post, comment):
        """Generate fake data."""
        from myblog.fakes import fake_admin, fake_categories, fake_posts, fake_comments

        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('Done.')
Beispiel #8
0
    def forge(thought, topic, post, comment):
        """Generate fake datas."""
        from myblog.fakes import fake_admin, fake_thoughts, fake_topics, fake_comments, fake_posts

        click.echo('Generating the administrator...')
        fake_admin()

        click.echo('Generating %d topics...' % topic)
        fake_topics(topic)

        click.echo('Generating %d posts...' % post)
        fake_posts(post)

        click.echo('Generating %d comments...' % comment)
        fake_comments(comment)

        click.echo('Generating %d thoughts...' % thought)
        fake_thoughts(thought)

        click.echo('Done.')
Beispiel #9
0
    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")
Beispiel #10
0
    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.')
Beispiel #11
0
    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('完成')