def run_application(self): log.debug('pidfile: %s' % self.pidfile) log.debug('runing app on port %d' % self.port) app_yaml = os.path.join(self.app_path, 'app.yaml') if not os.path.exists(app_yaml): log.error('there is no app.yaml at %s' % app_yaml) return #this is application yaml config yaml = ApplicationConfiguration(app_yaml) sys.path.insert(0, self.app_path) if yaml.runtime == 'python': yaml.provider = 'boost' set_yaml(yaml) if self.config.enable_logging: enable_logging = eval(self.config.enable_logging) appserver.HardenedModulesHook.ENABLE_LOGGING = enable_logging def yaml_to_dict(config): d = {} for attr in dir(config): if not attr.startswith('_'): value = getattr(config, attr) d[attr] = value return d['data'] option_dict = yaml_to_dict(self.config) if self.config.debug_mode: log_level = logging.DEBUG else: log_level = logging.INFO login_url = option_dict.get('login_url', '/_ah/login') template_dir = option_dict.get('template_dir', os.path.join(SDK_PATH, 'templates')) serve_address = option_dict.get('address', 'localhost') require_indexes = eval(option_dict.get('require_indexes', 'False')) allow_skipped_files = eval( option_dict.get('allow_skipped_files', 'False')) static_caching = eval(option_dict.get('static_caching', 'True')) cpu_monitor_interval = int( option_dict.get('cpu_monitor_interval', 1000)) option_dict['root_path'] = os.path.realpath(self.app_path) option_dict['login_url'] = login_url option_dict['datastore_path'] = os.path.join( tempfile.gettempdir(), 'dev_appserver.datastore') option_dict['clear_datastore'] = False option_dict['port'] = self.port logging.getLogger().setLevel(log_level) config = None try: config, matcher = appserver.LoadAppConfig(self.app_path, {}) except yaml_errors.EventListenerError, e: log.error( 'Fatal error when loading application configuration:\n' + str(e)) return 1 except appserver.InvalidAppConfigError, e: log.error('Application configuration file invalid:\n%s', e) return 1
def run_application(self): log.debug('pidfile: %s' % self.pidfile) log.debug('runing app on port %d' % self.port) app_yaml = os.path.join(self.app_path, 'app.yaml') if not os.path.exists(app_yaml): log.error('there is no app.yaml at %s' % app_yaml) return #this is application yaml config yaml = ApplicationConfiguration(app_yaml) sys.path.insert(0, self.app_path) if yaml.runtime == 'python': yaml.provider = 'boost' set_yaml(yaml) if self.config.enable_logging: enable_logging = eval(self.config.enable_logging) appserver.HardenedModulesHook.ENABLE_LOGGING = enable_logging def yaml_to_dict(config): d = {} for attr in dir(config): if not attr.startswith('_'): value = getattr(config, attr) d[attr] = value return d['data'] option_dict = yaml_to_dict(self.config) if self.config.debug_mode: log_level = logging.DEBUG else: log_level = logging.INFO login_url = option_dict.get('login_url', '/_ah/login') template_dir = option_dict.get('template_dir', os.path.join(SDK_PATH, 'templates')) serve_address = option_dict.get('address', 'localhost') require_indexes = eval(option_dict.get('require_indexes', 'False')) allow_skipped_files = eval(option_dict.get('allow_skipped_files', 'False')) static_caching = eval(option_dict.get('static_caching', 'True')) cpu_monitor_interval = int(option_dict.get('cpu_monitor_interval', 1000)) option_dict['root_path'] = os.path.realpath(self.app_path) option_dict['login_url'] = login_url option_dict['datastore_path'] = os.path.join(tempfile.gettempdir(), 'dev_appserver.datastore') option_dict['clear_datastore'] = False option_dict['port'] = self.port logging.getLogger().setLevel(log_level) config = None try: config, matcher = appserver.LoadAppConfig(self.app_path, {}) except yaml_errors.EventListenerError, e: log.error('Fatal error when loading application configuration:\n' + str(e)) return 1 except appserver.InvalidAppConfigError, e: log.error('Application configuration file invalid:\n%s', e) return 1