reword Blueprint class docstring

This commit is contained in:
David Lord 2019-06-12 14:01:49 -07:00
parent b89bf9e6d7
commit 571b9f54e7
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8

View file

@ -80,31 +80,51 @@ class BlueprintSetupState(object):
class Blueprint(_PackageBoundObject): class Blueprint(_PackageBoundObject):
"""Represents a blueprint. A blueprint is an object that records """Represents a blueprint, a collection of routes and other
functions that will be called with the app-related functions that can be registered on a real application
:class:`~flask.blueprints.BlueprintSetupState` later to register functions later.
or other things on the main application. See :ref:`blueprints` for more
information. A blueprint is an object that allows defining application functions
without requiring an application object ahead of time. It uses the
same decorators as :class:`~flask.Flask`, but defers the need for an
application by recording them for later registration.
Decorating a function with a blueprint creates a deferred function
that is called with :class:`~flask.blueprints.BlueprintSetupState`
when the blueprint is registered on an application.
See :ref:`blueprints` for more information.
.. versionadded:: 0.7 .. versionadded:: 0.7
:param name: the name of the Blueprint :param name: The name of the blueprint. Will be prepended to each
:param import_name: the name of the Blueprint package, __name__ most of the time. endpoint name.
The module folder will be the blueprint resource folder by default. :param import_name: The name of the blueprint package, usually
:param static_folder: you can serve your Blueprint static files by setting `static_folder` ``__name__``. This helps locate the ``root_path`` for the
to the folder with static files to serve at `static_url`. blueprint.
The path can be absolute or relative to the Blueprint resource folder :param static_folder: A folder with static files that should be
:param static_url: the url to serve static files from. Defaults to ``static_folder``. served by the blueprint's static route. The path is relative to
If your app's static_url is the same, your Blueprint's files won't be accessible. the blueprint's root path. Blueprint static files are disabled
:param template_folder: your blueprint can expose template from this folder by adding this path by default.
to the search path of templates. The path can be absolute or relative to :param static_url_path: The url to serve static files from.
the Blueprint resource folder. Defaults to ``static_folder``. If the blueprint does not have
:param url_prefix: url to prefix all the Blueprint routes. a ``url_prefix``, the app's static route will take precedence,
:param subdomain: If set up, Blueprint routes will match on this subdomain. and the blueprint's static files won't be accessible.
:param url_defaults: Blueprint routes will use these default values for :param template_folder: A folder with templates that should be added
view arguments. to the app's template search path. The path is relative to the
:param root_path: you can specify a different root_path than the module folder. blueprint's root path. Blueprint templates are disabled by
to become your Blueprint resource folder. default. Blueprint templates have a lower precedence than those
in the app's templates folder.
:param url_prefix: A path to prepend to all of the blueprint's URLs,
to make them distinct from the rest of the app's routes.
:param subdomain: A subdomain that blueprint routes will match on by
default.
:param url_defaults: A dict of default values that blueprint routes
will receive by default.
:param root_path: By default, the blueprint will automatically this
based on ``import_name``. In certain situations this automatic
detection can fail, so the path can be specified manually
instead.
""" """
warn_on_modifications = False warn_on_modifications = False