comparison libervia/server/server.py @ 1364:df40708c4c76

server: renamed `--dev_mode` to `--dev-mode` and set it as a flag: good practice is to use a dash instead of underscode for CLI arguments. This options is actually a flag, no need to specify the value.
author Goffi <goffi@goffi.org>
date Fri, 20 Nov 2020 17:53:01 +0100
parents 45ebeea1bacd
children 10517a8698ca
comparison
equal deleted inserted replaced
1363:c3dac1e11341 1364:df40708c4c76
1050 1050
1051 async def backendReady(self): 1051 async def backendReady(self):
1052 log.info(f"Libervia v{self.full_version}") 1052 log.info(f"Libervia v{self.full_version}")
1053 1053
1054 # settings 1054 # settings
1055 if self.options['dev_mode']: 1055 if self.options['dev-mode']:
1056 log.info(_("Developer mode activated")) 1056 log.info(_("Developer mode activated"))
1057 self.media_dir = await self.bridgeCall("getConfig", "", "media_dir") 1057 self.media_dir = await self.bridgeCall("getConfig", "", "media_dir")
1058 self.local_dir = await self.bridgeCall("getConfig", "", "local_dir") 1058 self.local_dir = await self.bridgeCall("getConfig", "", "local_dir")
1059 self.cache_root_dir = os.path.join(self.local_dir, C.CACHE_DIR) 1059 self.cache_root_dir = os.path.join(self.local_dir, C.CACHE_DIR)
1060 self.renderer = template.Renderer(self, self._front_url_filter) 1060 self.renderer = template.Renderer(self, self._front_url_filter)
1081 # self.sat_root is official Libervia site 1081 # self.sat_root is official Libervia site
1082 root_path = default_site_path / C.TEMPLATE_STATIC_DIR 1082 root_path = default_site_path / C.TEMPLATE_STATIC_DIR
1083 self.sat_root = default_root = LiberviaRootResource( 1083 self.sat_root = default_root = LiberviaRootResource(
1084 host=self, host_name='', site_name='', 1084 host=self, host_name='', site_name='',
1085 site_path=default_site_path, path=root_path) 1085 site_path=default_site_path, path=root_path)
1086 if self.options['dev_mode']: 1086 if self.options['dev-mode']:
1087 self.files_watcher.watchDir( 1087 self.files_watcher.watchDir(
1088 default_site_path, auto_add=True, recursive=True, 1088 default_site_path, auto_add=True, recursive=True,
1089 callback=LiberviaPage.onFileChange, site_root=self.sat_root, 1089 callback=LiberviaPage.onFileChange, site_root=self.sat_root,
1090 site_path=default_site_path) 1090 site_path=default_site_path)
1091 LiberviaPage.importPages(self, self.sat_root) 1091 LiberviaPage.importPages(self, self.sat_root)
1127 site_path=site_path, 1127 site_path=site_path,
1128 path=root_path) 1128 path=root_path)
1129 1129
1130 existing_vhosts[encoded_site_name] = res 1130 existing_vhosts[encoded_site_name] = res
1131 1131
1132 if self.options['dev_mode']: 1132 if self.options['dev-mode']:
1133 self.files_watcher.watchDir( 1133 self.files_watcher.watchDir(
1134 site_path, auto_add=True, recursive=True, 1134 site_path, auto_add=True, recursive=True,
1135 callback=LiberviaPage.onFileChange, site_root=res, 1135 callback=LiberviaPage.onFileChange, site_root=res,
1136 site_path=site_path) 1136 site_path=site_path)
1137 1137