-
Notifications
You must be signed in to change notification settings - Fork 282
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In the docs, there is an example for serving static files:
from fasthtml.common import *
app = FastHTML()
rt = app.route
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)
And this works. However, when using fast_app()
instead of FastHTML
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.route
and
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 with fast_app
we can also use static_path
argument to hook up static files, however I still think it's a bug since there is no reason to assume rt
behaves differently in both cases.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working