Home / Function/ create_jinja_environment() — flask Function Reference

create_jinja_environment() — flask Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a0656ef1_9a0d_d80d_c641_a8449df792e7["create_jinja_environment()"]
  9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5["Flask"]
  a0656ef1_9a0d_d80d_c641_a8449df792e7 -->|defined in| 9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5
  style a0656ef1_9a0d_d80d_c641_a8449df792e7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/app.py lines 468–506

    def create_jinja_environment(self) -> Environment:
        """Create the Jinja environment based on :attr:`jinja_options`
        and the various Jinja-related methods of the app. Changing
        :attr:`jinja_options` after this will have no effect. Also adds
        Flask-related globals and filters to the environment.

        .. versionchanged:: 0.11
           ``Environment.auto_reload`` set in accordance with
           ``TEMPLATES_AUTO_RELOAD`` configuration option.

        .. versionadded:: 0.5
        """
        options = dict(self.jinja_options)

        if "autoescape" not in options:
            options["autoescape"] = self.select_jinja_autoescape

        if "auto_reload" not in options:
            auto_reload = self.config["TEMPLATES_AUTO_RELOAD"]

            if auto_reload is None:
                auto_reload = self.debug

            options["auto_reload"] = auto_reload

        rv = self.jinja_environment(self, **options)
        rv.globals.update(
            url_for=self.url_for,
            get_flashed_messages=get_flashed_messages,
            config=self.config,
            # request, session and g are normally added with the
            # context processor for efficiency reasons but for imported
            # templates we also want the proxies in there.
            request=request,
            session=session,
            g=g,
        )
        rv.policies["json.dumps_function"] = self.json.dumps
        return rv

Subdomains

Defined In

Frequently Asked Questions

What does create_jinja_environment() do?
create_jinja_environment() is a function in the flask codebase, defined in src/flask/app.py.
Where is create_jinja_environment() defined?
create_jinja_environment() is defined in src/flask/app.py at line 468.

Analyze Your Own Codebase

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

Try Supermodel Free