Esempio n. 1
0
    def load_module(self, fullname):
        # TODO: is this needed?
        if fullname in sys.modules:
            return sys.modules[fullname]  # pragma: no cover

        if self.default_settings:
            default_settings_mod = import_module(self.default_settings)
        else:
            default_settings_mod = None

        settings_mod = create_module(self.name)

        # Django doesn't play too nice without the config file living as a real file, so let's fake it.
        settings_mod.__file__ = self.config_path

        # install the default settings for this app
        load_settings(default_settings_mod, allow_extras=self.allow_extras, settings=settings_mod)

        # install the custom settings for this app
        load_settings(self.config_path, allow_extras=self.allow_extras, settings=settings_mod)

        if self.callback:
            self.callback(settings_mod)

        return settings_mod
Esempio n. 2
0
    def _load_module(self, fullname):
        # TODO: is this needed?
        if fullname in sys.modules:
            return sys.modules[fullname]  # pragma: no cover

        if self.default_settings:
            default_settings_mod = import_module(self.default_settings)
        else:
            default_settings_mod = None

        settings_mod = create_module(self.name)

        # Django doesn't play too nice without the config file living as a real file, so let's fake it.
        settings_mod.__file__ = self.config_path

        # install the default settings for this app
        load_settings(default_settings_mod,
                      allow_extras=self.allow_extras,
                      settings=settings_mod)

        # install the custom settings for this app
        load_settings(self.config_path,
                      allow_extras=self.allow_extras,
                      settings=settings_mod)

        if self.callback:
            self.callback(settings_mod)

        return settings_mod
Esempio n. 3
0
        return

    parser.add_option("--config", metavar="CONFIG", default=default_config_path)

    (options, logan_args) = parser.parse_args(args)

    config_path = options.config

    if not os.path.exists(config_path):
        raise ValueError("Configuration file does not exist. Use '%s init' to initialize the file." % runner_name)

    if default_settings:
        settings_mod = import_module(default_settings)
        # TODO: logan should create a proxy module for its settings
        management.setup_environ(settings_mod)
        add_settings(settings_mod)

    load_settings(config_path)

    if initializer is not None:
        initializer({"project": project, "config_path": config_path})

    management.execute_from_command_line([runner_name, command] + command_args)

    sys.exit(0)


if __name__ == "__main__":
    run_app()