コード例 #1
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.')
コード例 #2
0
ファイル: __init__.py プロジェクト: xujunjie1234/blog
    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('已完成')
コード例 #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.")
コード例 #4
0
ファイル: commands.py プロジェクト: gloomyline/MyBlog
 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.')
コード例 #5
0
ファイル: __init__.py プロジェクト: lyhniupi1/myblog
    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("生成完成")
コード例 #6
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.')
コード例 #7
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.')
コード例 #8
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")
コード例 #9
0
ファイル: __init__.py プロジェクト: xiaoTaoist/flask-exercise
    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.')
コード例 #10
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('完成')