From 1cd45c0b0199b64daedee414c16136af2c93325d Mon Sep 17 00:00:00 2001 From: Javier Luraschi Date: Sat, 30 Nov 2024 14:36:10 -0800 Subject: [PATCH] [website] mention alternative to upload files under .storage --- website/learn/code/websites.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/website/learn/code/websites.md b/website/learn/code/websites.md index a66ec682..458f8f96 100644 --- a/website/learn/code/websites.md +++ b/website/learn/code/websites.md @@ -50,4 +50,16 @@ function go() { """, default={}) h9.save("index.html", files=files) +```` + +If you prefer to save the files without `h9.save()`, you can saave them under a subfolder under `./storage`. In order to render this folder correctly, use an appropriate extension; for example, `html` for a website: + +````py +base_path = './.storage/website.index.html/' +os.makedirs(base_path, exist_ok=True) + +for filename, content in files.items(): + file_path = os.path.join(base_path, filename) + with open(file_path, 'w', encoding='utf-8') as file: + file.write(content) ```` \ No newline at end of file