Mercurial > libervia-web
comparison libervia/server/server.py @ 1191:ba45dcdbeeaf
server: fixed sites alias:
host aliases were incorrectly detected (existing_vhosts was not filled) and pages were imported several times.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 27 May 2019 21:10:44 +0200 |
parents | eee7a896cf0e |
children | a15ac511390c |
comparison
equal
deleted
inserted
replaced
1190:b9a5418e9f2e | 1191:ba45dcdbeeaf |
---|---|
1920 host_name=host_name, | 1920 host_name=host_name, |
1921 site_name=site_name, | 1921 site_name=site_name, |
1922 site_path=site_path, | 1922 site_path=site_path, |
1923 path=root_path) | 1923 path=root_path) |
1924 | 1924 |
1925 existing_vhosts[site_name] = res | |
1926 | |
1925 if self.options['dev_mode']: | 1927 if self.options['dev_mode']: |
1926 self.files_watcher.watchDir( | 1928 self.files_watcher.watchDir( |
1927 site_path, auto_add=True, recursive=True, | 1929 site_path, auto_add=True, recursive=True, |
1928 callback=LiberviaPage.onFileChange, site_root=res, | 1930 callback=LiberviaPage.onFileChange, site_root=res, |
1929 site_path=site_path) | 1931 site_path=site_path) |
1930 tasks_manager = TasksManager(self, res) | 1932 tasks_manager = TasksManager(self, res) |
1931 yield tasks_manager.runTasks() | 1933 yield tasks_manager.runTasks() |
1932 res.putChild(C.BUILD_DIR, static.File(self.getBuildPath(site_name))) | 1934 res.putChild(C.BUILD_DIR, static.File(self.getBuildPath(site_name))) |
1935 | |
1936 LiberviaPage.importPages(self, res) | |
1937 # FIXME: default pages are accessible if not overriden by external website | |
1938 # while necessary for login or re-using existing pages | |
1939 # we may want to disable access to the page by direct URL | |
1940 # (e.g. /blog disabled except if called by external site) | |
1941 LiberviaPage.importPages(self, res, root_path=default_site_path) | |
1942 res._setMenu(self.options["menu_json"]) | |
1943 | |
1933 self.vhost_root.addHost(host_name.encode('utf-8'), res) | 1944 self.vhost_root.addHost(host_name.encode('utf-8'), res) |
1934 LiberviaPage.importPages(self, res) | |
1935 # FIXME: default pages are accessible if not overriden by external website | |
1936 # while necessary for login or re-using existing pages | |
1937 # we may want to disable access to the page by direct URL | |
1938 # (e.g. /blog disabled except if called by external site) | |
1939 LiberviaPage.importPages(self, res, root_path=default_site_path) | |
1940 res._setMenu(self.options["menu_json"]) | |
1941 | 1945 |
1942 templates_res = web_resource.Resource() | 1946 templates_res = web_resource.Resource() |
1943 self.putChildAll(C.TPL_RESOURCE, templates_res) | 1947 self.putChildAll(C.TPL_RESOURCE, templates_res) |
1944 for site_name, site_path in self.renderer.sites_paths.iteritems(): | 1948 for site_name, site_path in self.renderer.sites_paths.iteritems(): |
1945 templates_res.putChild(site_name or u'sat', ProtectedFile(site_path)) | 1949 templates_res.putChild(site_name or u'sat', ProtectedFile(site_path)) |