def setup_db(): db.create_all() # role_list = (('admin', 'admin'), ('default', 'default')) # Role.create_roles(role_list) # tag_list = [Tag.create(tag) for tag in ('Python', 'Flask', 'SQLAlchemy', 'Jinja')] # default_role = Role.create_role('default', 'default') # s = 'Body text' admin_role = Role.create_role('admin', 'admin') User.create(username='******', email='*****@*****.**', password='******', roles=admin_role) Post.generate_fake_posts()
#!/usr/bin/env python # coding: utf-8 from webapp import create_app from webapp.models import User, Role from webapp.extensions import db app = create_app('test') db.app = app db.create_all() default = Role.create_role('defalut') poster = Role.create_role('poster') test_user = User.create(username='******', password='******', roles=poster) app.run()