Home / Function/ send_static_file() — flask Function Reference

send_static_file() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4a852f3a_2bc8_50e9_493b_6ec8169d1a41["send_static_file()"]
  43802377_8224_2289_2f49_1129adf043ee["Blueprint"]
  4a852f3a_2bc8_50e9_493b_6ec8169d1a41 -->|defined in| 43802377_8224_2289_2f49_1129adf043ee
  afe24c34_5566_a80f_fbff_bb57cec6d844["get_send_file_max_age()"]
  4a852f3a_2bc8_50e9_493b_6ec8169d1a41 -->|calls| afe24c34_5566_a80f_fbff_bb57cec6d844
  cd968d21_9286_02d4_74b3_ae5e22f8a986["send_from_directory()"]
  4a852f3a_2bc8_50e9_493b_6ec8169d1a41 -->|calls| cd968d21_9286_02d4_74b3_ae5e22f8a986
  style 4a852f3a_2bc8_50e9_493b_6ec8169d1a41 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/blueprints.py lines 82–102

    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

Frequently Asked Questions

What does send_static_file() do?
send_static_file() is a function in the flask codebase, defined in src/flask/blueprints.py.
Where is send_static_file() defined?
send_static_file() is defined in src/flask/blueprints.py at line 82.
What does send_static_file() call?
send_static_file() calls 2 function(s): get_send_file_max_age, send_from_directory.

Analyze Your Own Codebase

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

Try Supermodel Free