Skip to content

Commit

Permalink
[website] mention alternative to upload files under .storage
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Nov 30, 2024
1 parent cc86fa2 commit 1cd45c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions website/learn/code/websites.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
````

0 comments on commit 1cd45c0

Please sign in to comment.