docs/examples/static_files/route_reverse.py
raw| 1 | from litestar import Litestar |
| 2 | from litestar.static_files import create_static_files_router |
| 3 | |
| 4 | app = Litestar( |
| 5 | route_handlers=[ |
| 6 | create_static_files_router(path="/static", directories=["assets"]), |
| 7 | ] |
| 8 | ) |
| 9 | |
| 10 | |
| 11 | print(app.route_reverse(name="static", file_path="/some_file.txt")) # /static/some_file.txt |