Add prefix for all commands in documentation (#2877)

* Add prefix for commands in docs

* Add prefix for commands in example's README
This commit is contained in:
Grey Li 2018-09-09 16:41:56 +08:00 committed by Hsiaoming Yang
parent b9b88b0cdf
commit 21b0aa6dd8
19 changed files with 112 additions and 112 deletions

View file

@ -204,7 +204,7 @@ Run the ``init-db`` command:
.. code-block:: none
flask init-db
$ flask init-db
Initialized the database.
There will now be a ``flaskr.sqlite`` file in the ``instance`` folder in

View file

@ -21,7 +21,7 @@ is installed first:
.. code-block:: none
pip install wheel
$ pip install wheel
Running ``setup.py`` with Python gives you a command line tool to issue
build-related commands. The ``bdist_wheel`` command will build a wheel
@ -29,7 +29,7 @@ distribution file.
.. code-block:: none
python setup.py bdist_wheel
$ python setup.py bdist_wheel
You can find the file in ``dist/flaskr-1.0.0-py3-none-any.whl``. The
file name is the name of the project, the version, and some tags about
@ -41,7 +41,7 @@ file with ``pip``.
.. code-block:: none
pip install flaskr-1.0.0-py3-none-any.whl
$ pip install flaskr-1.0.0-py3-none-any.whl
Pip will install your project along with its dependencies.
@ -50,8 +50,8 @@ create the database in the instance folder.
.. code-block:: none
export FLASK_APP=flaskr
flask init-db
$ export FLASK_APP=flaskr
$ flask init-db
When Flask detects that it's installed (not in editable mode), it uses
a different directory for the instance folder. You can find it at
@ -70,7 +70,7 @@ You can use the following command to output a random secret key:
.. code-block:: none
python -c 'import os; print(os.urandom(16))'
$ python -c 'import os; print(os.urandom(16))'
b'_5#y2L"F4Q8z\n\xec]/'
@ -99,7 +99,7 @@ first install it in the virtual environment:
.. code-block:: none
pip install waitress
$ pip install waitress
You need to tell Waitress about your application, but it doesn't use
``FLASK_APP`` like ``flask run`` does. You need to tell it to import and
@ -107,7 +107,7 @@ call the application factory to get an application object.
.. code-block:: none
waitress-serve --call 'flaskr:create_app'
$ waitress-serve --call 'flaskr:create_app'
Serving on http://0.0.0.0:8080

View file

@ -30,7 +30,7 @@ directory should be treated as a package.
.. code-block:: none
mkdir flaskr
$ mkdir flaskr
.. code-block:: python
:caption: ``flaskr/__init__.py``
@ -138,25 +138,25 @@ For Linux and Mac:
.. code-block:: none
export FLASK_APP=flaskr
export FLASK_ENV=development
flask run
$ export FLASK_APP=flaskr
$ export FLASK_ENV=development
$ flask run
For Windows cmd, use ``set`` instead of ``export``:
.. code-block:: none
set FLASK_APP=flaskr
set FLASK_ENV=development
flask run
> set FLASK_APP=flaskr
> set FLASK_ENV=development
> flask run
For Windows PowerShell, use ``$env:`` instead of ``export``:
.. code-block:: none
$env:FLASK_APP = "flaskr"
$env:FLASK_ENV = "development"
flask run
> $env:FLASK_APP = "flaskr"
> $env:FLASK_ENV = "development"
> flask run
You'll see output similar to this:

View file

@ -80,7 +80,7 @@ Use ``pip`` to install your project in the virtual environment.
.. code-block:: none
pip install -e .
$ pip install -e .
This tells pip to find ``setup.py`` in the current directory and install
it in *editable* or *development* mode. Editable mode means that as you
@ -91,7 +91,7 @@ You can observe that the project is now installed with ``pip list``.
.. code-block:: none
pip list
$ pip list
Package Version Location
-------------- --------- ----------------------------------

View file

@ -5,8 +5,8 @@ Create a project directory and enter it:
.. code-block:: none
mkdir flask-tutorial
cd flask-tutorial
$ mkdir flask-tutorial
$ cd flask-tutorial
Then follow the :doc:`installation instructions </installation>` to set
up a Python virtual environment and install Flask for your project.

View file

@ -28,7 +28,7 @@ Install them both:
.. code-block:: none
pip install pytest coverage
$ pip install pytest coverage
.. _pytest: https://pytest.readthedocs.io/
.. _coverage: https://coverage.readthedocs.io/
@ -510,7 +510,7 @@ the test functions you've written.
.. code-block:: none
pytest
$ pytest
========================= test session starts ==========================
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
@ -532,13 +532,13 @@ to run pytest instead of running it directly.
.. code-block:: none
coverage run -m pytest
$ coverage run -m pytest
You can either view a simple coverage report in the terminal:
.. code-block:: none
coverage report
$ coverage report
Name Stmts Miss Branch BrPart Cover
------------------------------------------------------
@ -553,7 +553,7 @@ An HTML report allows you to see which lines were covered in each file:
.. code-block:: none
coverage html
$ coverage html
This generates files in the ``htmlcov`` directory. Open
``htmlcov/index.html`` in your browser to see the report.