Add method copy_static_files

This commit is contained in:
2026-05-21 23:09:26 +02:00
committed by kitoy
parent 824fcc9639
commit 690db8ae6e

View File

@@ -178,7 +178,6 @@ class DataSite:
def writeHTML(self, theme:str, pageName :str, htmlExport :str): def writeHTML(self, theme:str, pageName :str, htmlExport :str):
publicFolder = Path(PurePosixPath(self.user_folder).joinpath('public')) publicFolder = Path(PurePosixPath(self.user_folder).joinpath('public'))
themesFolder = Path(PurePosixPath('app').joinpath('templates','themes', self.datas['config']['theme'],'static')) themesFolder = Path(PurePosixPath('app').joinpath('templates','themes', self.datas['config']['theme'],'static'))
publicStaticFolder = Path(PurePosixPath(self.user_folder).joinpath('public', 'static'))
if pageName == '/': if pageName == '/':
pageIndex = publicFolder / 'index.html' pageIndex = publicFolder / 'index.html'
@@ -188,8 +187,12 @@ class DataSite:
pageFolder.mkdir(exist_ok=True) pageFolder.mkdir(exist_ok=True)
pageIndex = pageFolder / 'index.html' pageIndex = pageFolder / 'index.html'
pageIndex.write_text(htmlExport) pageIndex.write_text(htmlExport)
def copy_static_files(self):
themesStaticFolder = Path(PurePosixPath('app').joinpath('static','themes', self.datas['config']['theme'],'static'))
publicStaticFolder = Path(PurePosixPath(self.user_folder).joinpath('public', 'static'))
rmtree (publicStaticFolder, ignore_errors=True) rmtree (publicStaticFolder, ignore_errors=True)
copytree(themesFolder, publicStaticFolder) copytree(themesStaticFolder, publicStaticFolder)
def publish(self, user:str, password:str, serverAddress:str, serverPort:int, folder:str): def publish(self, user:str, password:str, serverAddress:str, serverPort:int, folder:str):