#!/usr/bin/env python import os from autoP import create_app from autoP.models import * from flask_script import Manager, Shell # from flask_migrate import Migrate app = create_app(os.getenv('CONFIG') or 'default') manager = Manager(app) # migrate = Migrate(app) def make_shell_context(): return {'app': app, 'User': User, 'Permission': Permission, 'Role': Role, 'Result': Result, 'StepResult': StepResult, 'DataObject': DataObject} manager.add_command('shell', Shell(make_context=make_shell_context)) @manager.command def test(): import unittest tests_dir = os.path.abspath('.') tests = unittest.TestLoader().discover(tests_dir) unittest.TextTestRunner(verbosity=2).run(tests)
def setUpClass(cls): cls.app = create_app('testing') cls.current_app = cls.app cls.app_context = cls.app.app_context() cls.app_context.push()
from os import environ from autoP import create_app if __name__ == "__main__": config = environ.get("CONFIG") or "default" app = create_app(config) app.run()
def setUpClass(cls): cls.app = create_app('testing') # testing is lower case cls.current_app = cls.app cls.app_context = cls.app.app_context() cls.app_context.push() init_db()
#!/usr/bin/env python import os from autoP import create_app from autoP.models import * from flask_script import Manager, Shell # from flask_migrate import Migrate app = create_app(os.getenv('CONFIG') or 'default') manager = Manager(app) # migrate = Migrate(app) def make_shell_context(): return { 'app': app, 'User': User, 'Permission': Permission, 'Role': Role, 'Result': Result, 'StepResult': StepResult, 'DataObject': DataObject } manager.add_command('shell', Shell(make_context=make_shell_context)) @manager.command def test():