forked from orbit-oss/flask
Merge branch '1.0.x'
This commit is contained in:
commit
1351d0a565
84 changed files with 1029 additions and 1439 deletions
15
docs/cli.rst
15
docs/cli.rst
|
|
@ -10,7 +10,7 @@ interface, in your virtualenv. Executed from the terminal, this script gives
|
|||
access to built-in, extension, and application-defined commands. The ``--help``
|
||||
option will give more information about any commands and options.
|
||||
|
||||
.. _Click: http://click.pocoo.org/
|
||||
.. _Click: https://click.palletsprojects.com/
|
||||
|
||||
|
||||
Application Discovery
|
||||
|
|
@ -272,7 +272,7 @@ Custom Commands
|
|||
The ``flask`` command is implemented using `Click`_. See that project's
|
||||
documentation for full information about writing commands.
|
||||
|
||||
This example adds the command ``create_user`` that takes the argument
|
||||
This example adds the command ``create-user`` that takes the argument
|
||||
``name``. ::
|
||||
|
||||
import click
|
||||
|
|
@ -280,14 +280,14 @@ This example adds the command ``create_user`` that takes the argument
|
|||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.cli.command()
|
||||
@click.argument('name')
|
||||
@app.cli.command("create-user")
|
||||
@click.argument("name")
|
||||
def create_user(name):
|
||||
...
|
||||
|
||||
::
|
||||
|
||||
$ flask create_user admin
|
||||
$ flask create-user admin
|
||||
|
||||
This example adds the same command, but as ``user create``, a command in a
|
||||
group. This is useful if you want to organize multiple related commands. ::
|
||||
|
|
@ -310,7 +310,6 @@ group. This is useful if you want to organize multiple related commands. ::
|
|||
|
||||
$ flask user create demo
|
||||
|
||||
|
||||
See :ref:`testing-cli` for an overview of how to test your custom
|
||||
commands.
|
||||
|
||||
|
|
@ -417,7 +416,7 @@ they are installed. Entry points are specified in :file:`setup.py` ::
|
|||
)
|
||||
|
||||
|
||||
.. _entry point: https://packaging.python.org/tutorials/distributing-packages/#entry-points
|
||||
.. _entry point: https://packaging.python.org/tutorials/packaging-projects/#entry-points
|
||||
|
||||
Inside :file:`flask_my_extension/commands.py` you can then export a Click
|
||||
object::
|
||||
|
|
@ -486,7 +485,7 @@ script is available. Note that you don't need to set ``FLASK_APP``. ::
|
|||
The ``flask`` command, being separate from your code, does not have
|
||||
this issue and is recommended in most cases.
|
||||
|
||||
.. _console script: https://packaging.python.org/tutorials/distributing-packages/#console-scripts
|
||||
.. _console script: https://packaging.python.org/tutorials/packaging-projects/#console-scripts
|
||||
|
||||
|
||||
PyCharm Integration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue