Undocumented
Class |
|
This works similar to a regular click :class:`~click.Group` but it changes the behavior of the :meth:`command` decorator so that it automatically wraps the functions in :func:`with_appcontext`. |
Class |
|
Click option type for the ``--cert`` option. Allows either an existing file, the string ``'adhoc'``, or an import for a :class:`~ssl.SSLContext` object. |
Class |
|
Special subclass of the :class:`AppGroup` group that supports loading more commands from the configured Flask app. Normally a developer does not have to interface with this class but there are some very advanced use cases for which it makes sense to create an instance of this... |
Class |
|
Raised if an application cannot be found or loaded. |
Class |
|
Helper object to deal with Flask applications. This is usually not necessary to interface with as it's used internally in the dispatching to click. In future versions of Flask this object will most likely play a bigger role... |
Class |
|
Click option type that accepts a list of values separated by the OS's path separator (``:``, ``;`` on Windows). Each value is validated as a :class:`click.Path` type. |
Function | find |
Check if the given string is a variable name or a function. Call a function to get the app instance, or return the variable directly. |
Function | find |
Given a module instance this tries to find the best possible application in the module or raises an exception. |
Function | get |
Undocumented |
Function | load |
Load "dotenv" files in order of precedence to set environment variables. |
Function | locate |
Undocumented |
Function | main |
Undocumented |
Function | prepare |
Given a filename this will try to calculate the python path, add it to the search path and return the actual module name that is expected. |
Function | routes |
Show all registered routes with endpoints and methods. |
Function | run |
Run a local development server. |
Function | shell |
Run an interactive Python shell in the context of a given Flask application. The application will populate the default namespace of this shell according to its configuration. |
Function | show |
Show extra startup messages the first time the server is run, ignoring the reloader. |
Function | with |
Wraps a callback so that it's guaranteed to be executed with the script's application context. |
Variable | cli |
Undocumented |
Variable | pass |
Undocumented |
Variable | version |
Undocumented |
Function | _called |
Check whether calling a function raised a ``TypeError`` because the call failed or because something in the factory raised the error. |
Function | _env |
Undocumented |
Function | _path |
Take ``other`` and remove the length of ``path`` from it. Then join it to ``path``. If it is the original value, ``path`` is an ancestor of ``other``. |
Function | _set |
Undocumented |
Function | _set |
Undocumented |
Function | _validate |
The ``--key`` option must be specified when ``--cert`` is a file. Modifies the ``cert`` param to be a ``(cert, key)`` pair if needed. |
Variable | _app |
Undocumented |
Variable | _debug |
Undocumented |
Variable | _env |
Undocumented |
Check if the given string is a variable name or a function. Call a function to get the app instance, or return the variable directly.
Given a module instance this tries to find the best possible application in the module or raises an exception.
Load "dotenv" files in order of precedence to set environment variables. If an env var is already set it is not overwritten, so earlier files in the list are preferred over later files. This is a no-op if `python-dotenv`_ is not installed. .. _python-dotenv: https://github.com/theskumar/python-dotenv#readme :param path: Load the file at this location instead of searching. :return: ``True`` if a file was loaded. .. versionchanged:: 2.0 The current directory is not changed to the location of the loaded file. .. versionchanged:: 2.0 When loading the env files, set the default encoding to UTF-8. .. versionchanged:: 1.1.0 Returns ``False`` when python-dotenv is not installed, or when the given path isn't a file. .. versionadded:: 1.0
Given a filename this will try to calculate the python path, add it to the search path and return the actual module name that is expected.
@click.option(
@click.option(
@with_appcontext
def routes_command(sort:
str
, all_methods: bool
):
(source)
¶
Show all registered routes with endpoints and methods.
@click.option(
@click.option(
@click.option(
@click.option(
@click.option(
@click.option(
@click.option(
@click.option(
@click.option(
@pass_script_info
def run_command(info, host, port, reload, debugger, with_threads, cert, extra_files, exclude_patterns): (source) ¶
Run a local development server. This server is for development purposes only. It does not provide the stability, security, or performance of production WSGI servers. The reloader and debugger are enabled by default with the '--debug' option.
@with_appcontext
def shell_command(): (source) ¶
Run an interactive Python shell in the context of a given Flask application. The application will populate the default namespace of this shell according to its configuration. This is useful for executing small snippets of management code without having to manually configure the application.
Wraps a callback so that it's guaranteed to be executed with the script's application context. Custom commands (and their options) registered under ``app.cli`` or ``blueprint.cli`` will always have an app context available, this decorator is not required in that case. .. versionchanged:: 2.2 The app context is active for subcommands as well as the decorated callback. The app context is always available to ``app.cli`` command and parameter callbacks.
Check whether calling a function raised a ``TypeError`` because the call failed or because something in the factory raised the error. :param f: The function that was called. :return: ``True`` if the call failed.
click.Context
, param: click.Option
, value: str|None
) -> str|None
:
(source)
¶
Undocumented
Take ``other`` and remove the length of ``path`` from it. Then join it to ``path``. If it is the original value, ``path`` is an ancestor of ``other``.