Replies: 1 comment
-
Started using FastHTML today, and ran into this wall fast. Got it to work with the following code: from pathlib import Path
@rt("/{fname:path}.{ext:static}")
async def get(fname: str, ext: str):
current_dir = Path(__file__).resolve().parent
file_path = current_dir / "public" / f"{fname}.{ext}"
return FileResponse(file_path) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Docs show the following code for changing static media file locations:
I added that route and put my static content in
public/
, but I only gotNot Found
s. When I remove:static
from the route decorator, it worked. Did I do something wrong? Was:static
a typo? What is:path
?Beta Was this translation helpful? Give feedback.
All reactions