def register_manager(manager): """Register all manager plugins and default commands with the manager.""" from six.moves.urllib.parse import urlparse managers = RegistryProxy('managers', ModuleAutoDiscoveryRegistry, 'manage') with manager.app.app_context(): for script in find_modules('invenio.base.scripts'): manager.add_command( script.split('.')[-1], import_string(script + ':manager')) for script in managers: if script.__name__ == 'invenio.base.manage': continue manager.add_command( script.__name__.split('.')[-2], getattr(script, 'manager')) manager.add_command("clean", Clean()) manager.add_command("show-urls", ShowUrls()) manager.add_command("shell", Shell()) parsed_url = urlparse(manager.app.config.get('CFG_SITE_URL')) host = manager.app.config.get('SERVER_BIND_ADDRESS', parsed_url.hostname or '127.0.0.1') port = manager.app.config.get('SERVER_BIND_PORT', parsed_url.port or 80) runserver = Server(host=host, port=port) manager.add_command("runserver", runserver) # FIXME separation of concerns is violated here. from invenio.ext.collect import collect collect.init_script(manager) from invenio.ext.assets import command, bower manager.add_command("assets", command) manager.add_command("bower", bower)
def register_manager(manager): """Register all manager plugins and default commands with the manager.""" from six.moves.urllib.parse import urlparse managers = RegistryProxy('managers', ModuleAutoDiscoveryRegistry, 'manage') with manager.app.app_context(): for script in find_modules('invenio.base.scripts'): manager.add_command(script.split('.')[-1], import_string(script + ':manager')) for script in managers: if script.__name__ == 'invenio.base.manage': continue manager.add_command(script.__name__.split('.')[-2], getattr(script, 'manager')) manager.add_command("clean", Clean()) manager.add_command("show-urls", ShowUrls()) manager.add_command("shell", Shell()) parsed_url = urlparse(manager.app.config.get('CFG_SITE_URL')) port = parsed_url.port or 80 host = parsed_url.hostname or '127.0.0.1' runserver = Server(host=host, port=port) manager.add_command("runserver", runserver) # FIXME separation of concerns is violated here. from invenio.ext.collect import collect collect.init_script(manager) from invenio.ext.assets import command, bower manager.add_command("assets", command) manager.add_command("bower", bower)
def register_manager(manager): """Register all manager plugins and default commands with the manager.""" from six.moves.urllib.parse import urlparse from flask.ext.script.commands import Shell, Server, ShowUrls, Clean managers = RegistryProxy('managers', ModuleAutoDiscoveryRegistry, 'manage') with manager.app.app_context(): for script in find_modules('invenio.base.scripts'): manager.add_command(script.split('.')[-1], import_string(script + ':manager')) for script in managers: if script.__name__ == 'invenio.base.manage': continue manager.add_command(script.__name__.split('.')[-2], getattr(script, 'manager')) manager.add_command("clean", Clean()) manager.add_command("show-urls", ShowUrls()) manager.add_command("shell", Shell()) parsed_url = urlparse(manager.app.config.get('CFG_SITE_URL')) port = parsed_url.port or 80 host = parsed_url.hostname or '127.0.0.1' manager.add_command("runserver", Server(host=host, port=port)) from invenio.ext.collect import collect collect.init_script(manager) # Added for B2SHARE for debugging purposes print("Available blueprints:", [x.name for x in manager.app.blueprints.values()])
def register_manager(manager): """Register all manager plugins and default commands with the manager.""" from six.moves.urllib.parse import urlparse managers = RegistryProxy('managers', ModuleAutoDiscoveryRegistry, 'manage') def extract_name(name): """Guess manager name.""" parts = name.split('.') if len(parts) == 2: return parts[0].split('_')[-1] return parts[-2] with manager.app.app_context(): for script in find_modules('invenio.base.scripts'): manager.add_command(script.split('.')[-1], import_string(script + ':manager')) for script in managers: if script.__name__ == 'invenio.base.manage': continue manager.add_command(extract_name(script.__name__), getattr(script, 'manager')) manager.add_command("clean", Clean()) manager.add_command("show-urls", ShowUrls()) manager.add_command("shell", Shell()) parsed_url = urlparse(manager.app.config.get('CFG_SITE_URL')) host = manager.app.config.get( 'SERVER_BIND_ADDRESS', parsed_url.hostname or '127.0.0.1' ) port = manager.app.config.get( 'SERVER_BIND_PORT', parsed_url.port or 80 ) ssl_context = create_ssl_context(manager.app.config) runserver = Server(host=host, port=port, ssl_context=ssl_context) manager.add_command("runserver", runserver) # FIXME separation of concerns is violated here. from invenio.ext.collect import collect collect.init_script(manager) from invenio.ext.assets import command, bower manager.add_command("assets", command) manager.add_command("bower", bower)