Method: flask.scaffold.Scaffold.send_static_file
Calls: 15, Exceptions: 0, Paths: 1Back
Path 1: 15 calls (1.0)
'index.html' (9) 'static/index.html' (2) 'css/test.css' (2) 'test.txt' (1) FakePath (1)
Response (15)
1def send_static_file(self, filename: str) -> Response:
2 """The view function used to serve files from
3 :attr:`static_folder`. A route is automatically registered for
4 this view at :attr:`static_url_path` if :attr:`static_folder` is
5 set.
6
7 .. versionadded:: 0.5
8 """
9 if not self.has_static_folder:
10 raise RuntimeError("'static_folder' must be set to serve static_files.")
11
12 # send_file only knows to call get_send_file_max_age on the app,
13 # call it here so it works for blueprints too.
14 max_age = self.get_send_file_max_age(filename)
15 return send_from_directory(
16 t.cast(str, self.static_folder), filename, max_age=max_age
17 )