def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.create_all() from app.models import Roles Roles.insert_roles()
def db_populate(): Roles.insert_roles() Users.superadmin() return redirect('/login')
from app import Create_app, db from flask_migrate import Migrate from flask_script import Manager from app.models import Roles from flask import current_app app = Create_app('default') app_context = app.app_context() app_context.push() Roles.insert_roles() db.create_all() migrate = Migrate(app, db) manager = Manager(app) # @manager.command # def test(): # '''runs the unit tests''' # import unittest # test = unittest.TestLoader().discover('tests') # unittest.TextTestRunner(verbosity=2).run(tests) if __name__ == "__main__": app.run()