Esempio n. 1
0
    def init(self, project_dir, apps_dir):
        if not project_dir:
            project_dir = norm_path(os.path.join(apps_dir, '..'))

        Dispatcher.project_dir = project_dir
        Dispatcher.apps_dir = norm_path(os.path.join(project_dir, 'apps'))
        Dispatcher.apps = get_apps(self.apps_dir, self.include_apps,
                                   self.settings_file,
                                   self.local_settings_file)
        Dispatcher.modules = self.collect_modules()

        self.install_settings(self.modules['settings'])

        #process global_objects
        self.install_global_objects()

        #process binds
        self.install_binds()

        dispatch.call(self, 'after_init_settings')

        Dispatcher.settings = settings

        #process domains
        self.process_domains(settings)

        #setup log
        self.set_log()

        #set app rules
        rules.set_app_rules(dict(settings.get('URL', {})))

        Dispatcher.env = self._prepare_env()
        Dispatcher.template_dirs = self.get_template_dirs()
        Dispatcher.template_processors = {}
        self.install_template_processors()

        #begin to start apps
        self.install_apps()
        dispatch.call(self, 'after_init_apps')
        #process views
        self.install_views(self.modules['views'])
        #process exposes
        self.install_exposes()
        #process middlewares
        Dispatcher.middlewares = self.install_middlewares()

        self.debug = settings.GLOBAL.get('DEBUG', False)
        dispatch.call(self, 'prepare_default_env', Dispatcher.env)
        Dispatcher.default_template = pkg.resource_filename(
            'uliweb.core', 'default.html')

        Dispatcher.installed = True
Esempio n. 2
0
 def init(self, project_dir, apps_dir):
     if not project_dir:
         project_dir = norm_path(os.path.join(apps_dir, '..'))
     
     Dispatcher.project_dir = project_dir
     Dispatcher.apps_dir = norm_path(os.path.join(project_dir, 'apps'))
     Dispatcher.apps = get_apps(self.apps_dir, self.include_apps, self.settings_file, self.local_settings_file)
     Dispatcher.modules = self.collect_modules()
     
     self.install_settings(self.modules['settings'])
     
     #process global_objects
     self.install_global_objects()
     
     #process binds
     self.install_binds()
     
     dispatch.call(self, 'after_init_settings')
     
     Dispatcher.settings = settings
     
     #process domains
     self.process_domains(settings)
     
     #setup log
     self.set_log()
     
     #set app rules
     rules.set_app_rules(dict(settings.get('URL', {})))
     
     Dispatcher.env = self._prepare_env()
     Dispatcher.template_dirs = self.get_template_dirs()
     Dispatcher.template_processors = {}
     self.install_template_processors()
     
     #begin to start apps
     self.install_apps()
     dispatch.call(self, 'after_init_apps')
     #process views
     self.install_views(self.modules['views'])
     #process exposes
     self.install_exposes()
     #process middlewares
     Dispatcher.middlewares = self.install_middlewares()
     
     self.debug = settings.GLOBAL.get('DEBUG', False)
     dispatch.call(self, 'prepare_default_env', Dispatcher.env)
     Dispatcher.default_template = pkg.resource_filename('uliweb.core', 'default.html')
     
     Dispatcher.installed = True
Esempio n. 3
0
    def init(self, project_dir, apps_dir):
        if not project_dir:
            project_dir = norm_path(os.path.join(apps_dir, '..'))
        conf.project_dir = project_dir
        conf.apps_dir = norm_path(os.path.join(project_dir, 'apps'))
        Dispatcher.project_dir = project_dir
        Dispatcher.apps_dir = conf.apps_dir
        Dispatcher.apps = get_apps(self.apps_dir, self.include_apps, self.settings_file, self.local_settings_file)
        Dispatcher.modules = self.collect_modules()
        
        self.install_settings(self.modules['settings'])
        Dispatcher.settings = conf.settings
        
        #setup log
        self.set_log()
        
        #set app rules
        rules.set_app_rules(dict(conf.settings.get('URL', {})))
        
        Dispatcher.env = self._prepare_env()
        Dispatcher.template_dirs = self.get_template_dirs()
        
        #begin to start apps
        self.install_apps()
        
        dispatch.call(self, 'after_init_apps')

        Dispatcher.url_map = conf.url_map
        self.install_views(self.modules['views'])
        #process dispatch hooks
        self.dispatch_hooks()
        
        self.debug = conf.settings.GLOBAL.get('DEBUG', False)
        dispatch.call(self, 'prepare_default_env', Dispatcher.env)
        Dispatcher.default_template = pkg.resource_filename('uliweb.core', 'default.html')
        
        Dispatcher.installed = True