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()
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.')