Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[BUG] static route example doesn't work with fastapp #768

Open
Labels
bugSomething isn't working
@lucasvw

Description

@lucasvw

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.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 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp