def setup_app(ini_file, app_name): config_uri = '#'.join((ini_file, app_name)) settings = get_appsettings(config_uri) cfg = setup_config(settings) cfg.commit() return cfg
def _setup(conf=None, **kwargs): global app ini_file='production.ini' if 'NP_INI_FILE' in os.environ: ini_file = os.environ['NP_INI_FILE'] ini_name='netprofile' if 'NP_INI_NAME' in os.environ: ini_name = os.environ['NP_INI_NAME'] config_uri = '#'.join((ini_file, ini_name)) setup_logging(config_uri) settings = get_appsettings(config_uri) cfg = setup_config(settings) cfg.commit() mmgr = cfg.registry.getUtility(IModuleManager) mmgr.load('core') mmgr.load_enabled() _parse_ini_settings(cfg.registry, conf) app.settings = settings app.mmgr = mmgr
def _setup(conf=None, **kwargs): global app ini_file = 'production.ini' if 'NP_INI_FILE' in os.environ: ini_file = os.environ['NP_INI_FILE'] ini_name = 'netprofile' if 'NP_INI_NAME' in os.environ: ini_name = os.environ['NP_INI_NAME'] config_uri = '#'.join((ini_file, ini_name)) setup_logging(config_uri) settings = get_appsettings(config_uri) cfg = setup_config(settings) cfg.commit() mmgr = cfg.registry.getUtility(IModuleManager) mmgr.load('core') mmgr.load_enabled() _parse_ini_settings(cfg.registry, conf) app.config = cfg app.settings = settings app.mmgr = mmgr
def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) config = setup_config(settings) reg = threadlocal.get_current_registry() factory = pyramid_mako.MakoRendererFactory() name_resolver = DottedNameResolver() lookup_opts = pyramid_mako.parse_options_from_settings(settings, 'mako.', name_resolver.maybe_resolve) lookup_opts.update({ 'default_filters' : ['context[\'self\'].ddl.ddl_fmt'] }) factory.lookup = pyramid_mako.PkgResourceTemplateLookup(**lookup_opts) reg.registerUtility(factory, IRendererFactory, name='.mak') sess = DBSession() mm = ModuleManager(config) sess.execute(SetVariable('accessuid', 0)) sess.execute(SetVariable('accessgid', 0)) sess.execute(SetVariable('accesslogin', '[CREATEDB]')) mm.scan() mm.install('core', sess) for moddef in mm.modules: if moddef != 'core': mm.install(moddef, sess)
def app_config(self): config_uri = '#'.join( (self.options.ini_file, self.options.application)) settings = get_appsettings(config_uri) cfg = setup_config(settings) cfg.commit() return cfg
def app_config(self): config_uri = '#'.join(( self.options.ini_file, self.options.application )) settings = get_appsettings(config_uri) cfg = setup_config(settings) cfg.commit() return cfg
def app_config(self): settings = get_appsettings(self.config_uri) cfg = setup_config(settings) cfg.commit() return cfg