def _setup_script_manager(self): manager = self.script_manager if manager is None or isinstance(manager, ScriptManager): return if isinstance(manager, string_types): manager = str(manager) if manager.startswith('.'): manager = self.import_name + manager manager_import_path = manager manager = import_string(manager, silent=True) if manager is None: # fallback on abilian-core's logger.warning( '\n' + ('*' * 79) + '\n' 'Could not find command manager at %r, using a default one\n' 'Some commands might not be available\n' + ('*' * 79) + '\n', manager_import_path) from abilian.core.commands import setup_abilian_commands manager = ScriptManager() setup_abilian_commands(manager) self.script_manager = manager
def _setup_script_manager(self): manager = self.script_manager if manager is None or isinstance(manager, ScriptManager): return if isinstance(manager, (bytes, unicode)): manager = str(manager) if manager.startswith('.'): manager = self.import_name + manager manager_import_path = manager manager = import_string(manager, silent=True) if manager is None: # fallback on abilian-core's logger.warning( '\n' + ('*' * 79) + '\n' 'Could not find command manager at %r, using a default one\n' 'Some commands might not be available\n' + ('*' * 79) + '\n', manager_import_path) from abilian.core.commands import setup_abilian_commands manager = ScriptManager() setup_abilian_commands(manager) self.script_manager = manager
#!/usr/bin/env python # coding=utf-8 """ """ from __future__ import absolute_import import logging from flask_script import Manager from abilian.core.commands import setup_abilian_commands from abilian.sbe.app import Application def create_app(): return Application(name='myapp') if __name__ == '__main__': logging.basicConfig() logging.getLogger().setLevel(logging.INFO) manager = Manager(create_app) setup_abilian_commands(manager) manager.run()
#!./bin/python # coding=utf-8 """ """ from __future__ import absolute_import import logging from flask.ext.script import Manager from abilian.core.commands import setup_abilian_commands from abilian.sbe.app import Application def create_app(): app = Application(name='sbe-demo') return app if __name__ == '__main__': logging.basicConfig() manager = Manager(create_app) setup_abilian_commands(manager) manager.run()