Home / Function/ send_static_file() — flask Function Reference

send_static_file() — flask Function Reference

Architecture documentation for the send_static_file() function in app.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  0961f519_f2ef_dd1b_2adf_c3eaabdb53a7["send_static_file()"]
  9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5["Flask"]
  0961f519_f2ef_dd1b_2adf_c3eaabdb53a7 -->|defined in| 9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5
  21993c25_d44a_bd35_e477_2d16af1e7237["__init__()"]
  21993c25_d44a_bd35_e477_2d16af1e7237 -->|calls| 0961f519_f2ef_dd1b_2adf_c3eaabdb53a7
  b9ae92e8_aac9_2239_118e_1bf35728c3f1["get_send_file_max_age()"]
  0961f519_f2ef_dd1b_2adf_c3eaabdb53a7 -->|calls| b9ae92e8_aac9_2239_118e_1bf35728c3f1
  cd968d21_9286_02d4_74b3_ae5e22f8a986["send_from_directory()"]
  0961f519_f2ef_dd1b_2adf_c3eaabdb53a7 -->|calls| cd968d21_9286_02d4_74b3_ae5e22f8a986
  style 0961f519_f2ef_dd1b_2adf_c3eaabdb53a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/app.py lines 391–411

    def send_static_file(self, filename: str) -> Response:
        """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.

        .. versionadded:: 0.5

        """
        if not self.has_static_folder:
            raise RuntimeError("'static_folder' must be set to serve static_files.")

        # send_file only knows to call get_send_file_max_age on the app,
        # call it here so it works for blueprints too.
        max_age = self.get_send_file_max_age(filename)
        return send_from_directory(
            t.cast(str, self.static_folder), filename, max_age=max_age
        )

Subdomains

Defined In

Called By

Frequently Asked Questions

What does send_static_file() do?
send_static_file() is a function in the flask codebase, defined in src/flask/app.py.
Where is send_static_file() defined?
send_static_file() is defined in src/flask/app.py at line 391.
What does send_static_file() call?
send_static_file() calls 2 function(s): get_send_file_max_age, send_from_directory.
What calls send_static_file()?
send_static_file() is called by 1 function(s): __init__.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free