The view function used to serve files from :attr:`static_folder`. A route is automatically registered for this view at :attr:`static_url_path` if :attr:`static_folder` is set. Note this is a duplicate of the same method in the Flask class. .. version
(self, filename: str)
| 306 | return value # type: ignore[no-any-return] |
| 307 | |
| 308 | def send_static_file(self, filename: str) -> Response: |
| 309 | """The view function used to serve files from |
| 310 | :attr:`static_folder`. A route is automatically registered for |
| 311 | this view at :attr:`static_url_path` if :attr:`static_folder` is |
| 312 | set. |
| 313 | |
| 314 | Note this is a duplicate of the same method in the Flask |
| 315 | class. |
| 316 | |
| 317 | .. versionadded:: 0.5 |
| 318 | |
| 319 | """ |
| 320 | if not self.has_static_folder: |
| 321 | raise RuntimeError("'static_folder' must be set to serve static_files.") |
| 322 | |
| 323 | # send_file only knows to call get_send_file_max_age on the app, |
| 324 | # call it here so it works for blueprints too. |
| 325 | max_age = self.get_send_file_max_age(filename) |
| 326 | return send_from_directory( |
| 327 | t.cast(str, self.static_folder), filename, max_age=max_age |
| 328 | ) |
| 329 | |
| 330 | def open_resource( |
| 331 | self, resource: str, mode: str = "rb", encoding: str | None = None |