diff libervia/server/server.py @ 1253:6d49fae517ba

pages: browser metadata + root `_browser`: - the `_browser` directory can now be put in root of a site `pages` directory, it will then include modules for the whole website - in `_browser` directories (notably the root one), a `browser_meta.json` file can be put to specify settings for a browser engine - pathlib.Path is now used LiberviaRootResource.site_path - introduced some type hints - task_brython copy modules in root `_browser` to build_path root. - minimal python version is now 3.7 due to type hints
author Goffi <goffi@goffi.org>
date Wed, 29 Apr 2020 17:34:53 +0200
parents a1606e2a92eb
children 08cd652dea14
line wrap: on
line diff
--- a/libervia/server/server.py	Wed Apr 29 15:00:54 2020 +0200
+++ b/libervia/server/server.py	Wed Apr 29 17:34:53 2020 +0200
@@ -183,7 +183,7 @@
         self.host = host
         self.host_name = host_name
         self.site_name = site_name
-        self.site_path = site_path
+        self.site_path = Path(site_path)
         self.named_pages = {}
         self.browser_modules = {}
         self.uri_callbacks = {}
@@ -786,9 +786,9 @@
 
         # we create virtual hosts and import Libervia pages into them
         self.vhost_root = vhost.NameVirtualHost()
-        default_site_path = os.path.abspath(os.path.dirname(libervia.__file__))
+        default_site_path = Path(libervia.__file__).parent.resolve()
         # self.sat_root is official Libervia site
-        root_path = os.path.join(default_site_path, C.TEMPLATE_STATIC_DIR)
+        root_path = default_site_path / C.TEMPLATE_STATIC_DIR
         self.sat_root = default_root = LiberviaRootResource(
             host=self, host_name='', site_name='',
             site_path=default_site_path, path=root_path)