- Notifications
You must be signed in to change notification settings - Fork282
Open
Description
Describe the bug
In the docs, there is an example for serving static files:
from fasthtml.common import *app = FastHTML()rt = app.routecli = Client(app)reg_re_param("imgext", "ico|gif|jpg|jpeg|webm")@rt(r'/static/{fn}.{ext:imgext}')def get(fn:str, ext:str): return f"Getting {fn}.{ext}"print(cli.get('/static/jph.ico').text)And this works. However, when usingfast_app() instead ofFastHTML this no longer works:
from fasthtml.common import *app, rt = fast_app()cli = Client(app)reg_re_param("imgext", "ico|gif|jpg|jpeg|webm")@rt(r'/static/{fn}.{ext:imgext}')def get(fn:str, ext:str): return f"Getting {fn}.{ext}"print(cli.get('/static/jph.ico').text)Minimal Reproducible Example
See above
Expected behavior
I expect that getting the routes through:
app = FastHTML()rt = app.routeand
app, rt = fast_app()would behave similarly, but they don't
Environment Information
Please provide the following version information:
- fastlite version: 0.2.1
- fastcore version: 1.8.7
- fasthtml version: 0.12.22
Confirmation
Please confirm the following:
- I have read the FAQ (https://docs.fastht.ml/explains/faq.html) -->bad link
- I have provided a minimal reproducible example
- I have included the versions of fastlite, fastcore, and fasthtml
- I understand that this is a volunteer open source project with no commercial support.
Additional context
I understand that withfast_app we can also usestatic_path argument to hook up static files, however I still think it's a bug since there is no reason to assumert behaves differently in both cases.