Exemplo n.º 1
0
    def forge(category, post, comment, channel, website):
        """Generate fake data."""
        from bluelog.fakes import fake_admin, fake_categories, fake_posts, fake_comments, fake_links, fake_channels, fake_websites

        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)

        #lsc
        click.echo('Generating %d channels...' % channel)
        fake_channels(channel)
        #lsc
        click.echo('Generating %d websites...' % website)
        fake_websites(website)

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

        click.echo('Generating links...')
        fake_links()

        click.echo('Done.')
Exemplo n.º 2
0
    def forge(category, post, comment):
        '''生成虚拟数据'''
        from bluelog.fakes import fake_admin, fake_categories, fake_posts, fake_comments, fake_links

        db.drop_all()
        db.create_all()

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

        click.echo(f'生成 {category} 个分类...')
        fake_categories(category)

        click.echo(f'生成 {post} 篇文章...')
        fake_posts(post)

        click.echo(f'生成 {comment} 条评论...')
        fake_comments(comment)

        click.echo('生成链接...')
        fake_links()

        if not os.path.exists(config['base'].CKEDITOR_UPLOAD_PATH):
            click.echo('图像上传路径不存在,创建中...')
            os.mkdir(config['base'].CKEDITOR_UPLOAD_PATH)

        click.echo('完成')
Exemplo n.º 3
0
    def forge(category, tag, post, comment):
        """Generate fake data."""
        from bluelog.fakes import fake_admin, fake_categories, fake_tags, 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 tags...' % tag)
        fake_tags(tag)

        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.')
Exemplo n.º 4
0
    def forge(category, post, comment):
        """Generate fake data."""
        from bluelog.fakes import fake_admin, fake_categories, fake_posts, fake_comments, fake_links

        click.echo('dropping old database...')
        db.drop_all()
        click.echo('creating new database...')
        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.')
Exemplo n.º 5
0
    def forge(category, post, comment, url):
        """Generates the fake categories, posts, and comments.

        生成假数据用于展示效果。

        Args:
            category:生成分类数量,默认为10
            post:生成文章数量,默认为50
            comment:生成评论数量,默认为500
            url:生成链接数量,默认为5

        """
        from bluelog.fakes import (fake_admin, fake_categories, fake_posts,
                                   fake_comments, fake_url)

        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('Gemerating %d comments..' % comment)
        fake_comments(comment)

        click.echo('Generating %d urls..' % url)
        fake_url(url)

        click.echo('Done.')
Exemplo n.º 6
0
 def forge(category, post, comment):
     """Generate the fake categories,posts,comments."""
     db.drop_all()
     db.create_all()
     click.echo('Generating the administrator...')
     fake_admin()
     click.echo(f'Generating {category} categories...')
     fake_categories(category)
     click.echo(f'Generating {post} posts...')
     fake_post(post)
     click.echo(f'Generating {comment} comment...')
     fake_comments(comment)
     click.echo('Done.')
Exemplo n.º 7
0
 def forge(category, post, comment):
     """Generates the fake categories, posts, and comments."""
     from bluelog.fakes import fake_categories, fake_post, fake_comments, fake_admim
     db.drop_all()
     db.create_all()
     click.echo('Generating the administrator...')
     fake_admim()
     click.echo('Generating %d categories...' % category)
     fake_categories()
     click.echo('Generating %d posts...' % post)
     fake_post()
     click.echo('Generating %d comments...' % comment)
     fake_comments()
     click.echo('Done.')
Exemplo n.º 8
0
    def forge(article, comment):
        """Generate fake data."""
        from bluelog.fakes import fake_blogger, fake_articles, fake_comments

        db.drop_all()
        db.create_all()

        click.echo('Generating the blogger...')
        fake_blogger()

        click.echo('Generating %d categories...' % article)
        fake_articles(article)

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

        click.echo('Done.')
Exemplo n.º 9
0
    def forge(category, post, comment):
        from bluelog.fakes import fake_admin, fake_categories, fake_comments, fake_posts
        # 删除所有表
        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 categories...' % post)
        fake_posts(post)

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

        click.echo('Done.')
Exemplo n.º 10
0
    def forge(category, post, comment):
        from bluelog.fakes import fake_admin, fake_categories, fake_posts, fake_comments

        db.drop_all()
        db.create_all()

        click.echo('正在生成管理员数据')
        fake_admin()

        click.echo('正在生成%s条分类数据' % category)
        fake_categories(category)

        click.echo('正在生成%s条文章数据' % post)
        fake_posts(post)

        click.echo('正在生成%s条评论数据' % comment)
        fake_comments(comment)

        click.echo("数据生成完毕!!!")
Exemplo n.º 11
0
    def forge(category, post, comment):
        from bluelog.fakes import fake_admin, fake_comments, fake_categories, fake_posts

        db.drop_all()
        db.create_all()

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

        click.echo('Generating {} categories...'.format(category))
        fake_categories()

        click.echo('Generating {} posts...'.format(post))
        fake_posts()

        click.echo('Generating {} comments...'.format(comment))
        fake_comments()

        click.echo('done')
Exemplo n.º 12
0
    def forge(category, post, comment):
        """生成虚拟分类、文章、评论数据"""
        from bluelog.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(f'Generating {category} categories...')
        fake_categories(category)

        click.echo(f'Generating {post} posts...')
        fake_posts(post)

        click.echo(f'Generating {comment} comments...')
        fake_comments(comment)

        click.echo('Done.')
Exemplo n.º 13
0
    def forge(category, post, comment):
        """Generates the fake categories, posts, comments."""
        from bluelog.fakes import fake_admin, fake_categories, fake_comments, fake_posts
        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('完成')
Exemplo n.º 14
0
    def forge(category, post, comment):
        """Generate fake information"""
        from bluelog.fakes import fake_admin, fake_category, fake_post, fake_comments

        db.drop_all()
        db.create_all()

        click.echo('Generating fake admin...')
        fake_admin()

        click.echo('Generating %d fake categories...' % category)
        fake_category(category)

        click.echo('Generating %d fake posts...' % post)
        fake_post(post)

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

        click.echo('Done.')
Exemplo n.º 15
0
    def forge_new(category, post, comment):

        db.drop_all()
        db.create_all()

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

        click.echo('Generating %d categories...' % category)
        fake_categories()

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

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

        click.echo('Generating links...')
        fake_links()

        click.echo('Done.')
Exemplo n.º 16
0
    def forge(category, post, comment, tag):
        """Generate fake data"""
        from bluelog.fakes import fake_admin, fake_categories, fake_posts, \
            fake_comments
        db.drop_all()
        db.create_all()

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

        click.echo(f'Generating {category} categories...')
        fake_categories(category)

        click.echo(f'Generating {post} posts...')
        fake_posts(post)

        click.echo(f'Generating {comment} comments...')
        fake_comments(comment)

        click.echo(f'Done!!!')
Exemplo n.º 17
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('Generating links...')
        fake_links()

        click.echo('Done!')
Exemplo n.º 18
0
    def forge(category, post, comment):
        """构造虚拟数据"""
        from bluelog.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)

        click.echo('生成 %d 文章...' % post)
        fake_posts(post)

        click.echo('生成 %d 评论...' % comment)
        fake_comments(comment)

        click.echo('生成链接...')
        fake_links()

        click.echo('构造完成...')
Exemplo n.º 19
0
    def forge(category, post, comment):
        """Generates the fake categories, post, and comments"""
        from bluelog.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 {} categories...'.format(category))
        fake_categories()

        click.echo('Generating {} posts...'.format(post))
        fake_posts()

        click.echo('Generating {} comments...'.format(comment))
        fake_comments()

        click.echo('Generating links...')
        fake_links()

        click.echo('Done.')