Scaffold Class — flask Architecture
Architecture documentation for the Scaffold class in scaffold.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD a813bd5c_bf41_d926_8dde_6a113d5e0018["Scaffold"] b48dce3f_427c_079b_4c4a_8f5873f5b51f["scaffold.py"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|defined in| b48dce3f_427c_079b_4c4a_8f5873f5b51f 736a231a_9025_7df3_3587_be4da4bc2c28["__init__()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| 736a231a_9025_7df3_3587_be4da4bc2c28 b5da1b5f_0ddb_e0bd_647e_85083884730a["__repr__()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| b5da1b5f_0ddb_e0bd_647e_85083884730a 5fd0b830_b3eb_e218_37fd_d483863b820d["_check_setup_finished()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| 5fd0b830_b3eb_e218_37fd_d483863b820d 3d888505_0ba2_b98c_2c97_1f24de458984["static_folder()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| 3d888505_0ba2_b98c_2c97_1f24de458984 efc08ead_9b86_c11d_0a30_67124b09cd5a["has_static_folder()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| efc08ead_9b86_c11d_0a30_67124b09cd5a 594f3454_29cc_e12c_61cb_842a3d508ae7["static_url_path()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| 594f3454_29cc_e12c_61cb_842a3d508ae7 6e9536f9_a2f0_94f6_c855_82fd8fd82702["jinja_loader()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| 6e9536f9_a2f0_94f6_c855_82fd8fd82702 dd7bc248_9018_29f8_7780_802bd55191fc["_method_route()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| dd7bc248_9018_29f8_7780_802bd55191fc cd459c23_b1c5_45ac_a393_26c2ff268367["get()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| cd459c23_b1c5_45ac_a393_26c2ff268367 aeb26497_2682_92fb_def9_e8901d725968["post()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| aeb26497_2682_92fb_def9_e8901d725968 bc08e1d4_7552_2132_7986_00d2edd74f7e["put()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| bc08e1d4_7552_2132_7986_00d2edd74f7e c2282b16_5a51_e3a8_35f2_9059714c4a21["delete()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| c2282b16_5a51_e3a8_35f2_9059714c4a21 3faf4a42_e556_ebdc_e304_1b6fb1ec458b["patch()"] a813bd5c_bf41_d926_8dde_6a113d5e0018 -->|method| 3faf4a42_e556_ebdc_e304_1b6fb1ec458b
Relationship Graph
Source Code
src/flask/sansio/scaffold.py lines 52–698
class Scaffold:
"""Common behavior shared between :class:`~flask.Flask` and
:class:`~flask.blueprints.Blueprint`.
:param import_name: The import name of the module where this object
is defined. Usually :attr:`__name__` should be used.
:param static_folder: Path to a folder of static files to serve.
If this is set, a static route will be added.
:param static_url_path: URL prefix for the static route.
:param template_folder: Path to a folder containing template files.
for rendering. If this is set, a Jinja loader will be added.
:param root_path: The path that static, template, and resource files
are relative to. Typically not set, it is discovered based on
the ``import_name``.
.. versionadded:: 2.0
"""
cli: Group
name: str
_static_folder: str | None = None
_static_url_path: str | None = None
def __init__(
self,
import_name: str,
static_folder: str | os.PathLike[str] | None = None,
static_url_path: str | None = None,
template_folder: str | os.PathLike[str] | None = None,
root_path: str | None = None,
):
#: The name of the package or module that this object belongs
#: to. Do not change this once it is set by the constructor.
self.import_name = import_name
self.static_folder = static_folder
self.static_url_path = static_url_path
#: The path to the templates folder, relative to
#: :attr:`root_path`, to add to the template loader. ``None`` if
#: templates should not be added.
self.template_folder = template_folder
if root_path is None:
root_path = get_root_path(self.import_name)
#: Absolute path to the package on the filesystem. Used to look
#: up resources contained in the package.
self.root_path = root_path
#: A dictionary mapping endpoint names to view functions.
#:
#: To register a view function, use the :meth:`route` decorator.
#:
#: This data structure is internal. It should not be modified
#: directly and its format may change at any time.
self.view_functions: dict[str, ft.RouteCallable] = {}
#: A data structure of registered error handlers, in the format
#: ``{scope: {code: {class: handler}}}``. The ``scope`` key is
#: the name of a blueprint the handlers are active for, or
#: ``None`` for all requests. The ``code`` key is the HTTP
#: status code for ``HTTPException``, or ``None`` for
#: other exceptions. The innermost dictionary maps exception
#: classes to handler functions.
#:
#: To register an error handler, use the :meth:`errorhandler`
#: decorator.
#:
#: This data structure is internal. It should not be modified
#: directly and its format may change at any time.
self.error_handler_spec: dict[
ft.AppOrBlueprintKey,
dict[int | None, dict[type[Exception], ft.ErrorHandlerCallable]],
] = defaultdict(lambda: defaultdict(dict))
#: A data structure of functions to call at the beginning of
#: each request, in the format ``{scope: [functions]}``. The
#: ``scope`` key is the name of a blueprint the functions are
#: active for, or ``None`` for all requests.
#:
Domain
Defined In
Source
Frequently Asked Questions
What is the Scaffold class?
Scaffold is a class in the flask codebase, defined in src/flask/sansio/scaffold.py.
Where is Scaffold defined?
Scaffold is defined in src/flask/sansio/scaffold.py at line 52.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free