Exemplo n.º 1
0
def fake_admin():
    admin = Admin(username='******',
                  blog_title='Home',
                  blog_sub_title='I can you can too',
                  name='Arvine',
                  about='I\'am on my way.')
    admin.password = '******'
    db.session.add(admin)
    db.session.commit()
Exemplo n.º 2
0
    def init(username, password):
        click.echo('Initializing the database...')
        db.create_all()

        admin = Admin.query.first()
        if admin:
            admin.username = username
            admin.password = password
        else:
            admin = Admin(username=username,
                          blog_title='Home',
                          blog_sub_title='I can you can too',
                          name='Arvine',
                          about='I\'am on my way.')
            admin.password = password
            db.session.add(admin)
        category = Category.query.first()
        if category is None:
            click.echo('Creating the default category...')
            category = Category(name='Default')
            db.session.add(category)

        db.session.commit()
        click.echo('Done.')