Skip to content

Commit

Permalink
Add prefix for all commands in documentation (#2877)
Browse files Browse the repository at this point in the history
* Add prefix for commands in docs

* Add prefix for commands in example's README
  • Loading branch information
greyli authored and lepture committed Sep 9, 2018
1 parent b9b88b0 commit 21b0aa6
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 112 deletions.
18 changes: 9 additions & 9 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ command, instead of ``flask run --port 8000``:

.. code-block:: none
export FLASK_RUN_PORT=8000
flask run
$ export FLASK_RUN_PORT=8000
$ flask run
* Running on http://127.0.0.1:8000/
These can be added to the ``.flaskenv`` file just like ``FLASK_APP`` to
Expand All @@ -211,7 +211,7 @@ python-dotenv is not installed.

.. code-block:: none
flask run
$ flask run
* Tip: There are .env files present. Do "pip install python-dotenv" to use them.
You can tell Flask not to load dotenv files even when python-dotenv is
Expand All @@ -223,8 +223,8 @@ configure as expected.

.. code-block:: none
export FLASK_SKIP_DOTENV=1
flask run
$ export FLASK_SKIP_DOTENV=1
$ flask run
Environment Variables From virtualenv
Expand All @@ -236,11 +236,11 @@ script. Activating the virtualenv will set the variables.

Unix Bash, :file:`venv/bin/activate`::

export FLASK_APP=hello
$ export FLASK_APP=hello

Windows CMD, :file:`venv\\Scripts\\activate.bat`::

set FLASK_APP=hello
> set FLASK_APP=hello

It is preferred to use dotenv support over this, since :file:`.flaskenv` can be
committed to the repository so that it works automatically wherever the project
Expand Down Expand Up @@ -268,7 +268,7 @@ This example adds the command ``create_user`` that takes the argument

::

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. ::
Expand All @@ -289,7 +289,7 @@ group. This is useful if you want to organize multiple related commands. ::

::

flask user create demo
$ flask user create demo

See :ref:`testing-cli` for an overview of how to test your custom
commands.
Expand Down
8 changes: 4 additions & 4 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The following configuration values are used internally by Flask:
application. It should be a long random string of bytes, although unicode
is accepted too. For example, copy the output of this to your config::

python -c 'import os; print(os.urandom(16))'
$ python -c 'import os; print(os.urandom(16))'
b'_5#y2L"F4Q8z\n\xec]/'

**Do not reveal the secret key when posting questions or committing code.**
Expand Down Expand Up @@ -419,7 +419,7 @@ server::

On Windows systems use the `set` builtin instead::

>set YOURAPPLICATION_SETTINGS=\path\to\settings.cfg
> set YOURAPPLICATION_SETTINGS=\path\to\settings.cfg

The configuration files themselves are actual Python files. Only values
in uppercase are actually stored in the config object later on. So make
Expand Down Expand Up @@ -455,8 +455,8 @@ the shell before starting the server::

On Windows systems use the `set` builtin instead::

>set SECRET_KEY='5f352379324c22463451387a0aec5d2f'
>set DEBUG=False
> set SECRET_KEY='5f352379324c22463451387a0aec5d2f'
> set DEBUG=False

While this approach is straightforward to use, it is important to remember that
environment variables are strings -- they are not automatically deserialized
Expand Down
2 changes: 1 addition & 1 deletion docs/deploying/fastcgi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ can execute it:

.. sourcecode:: text

# chmod +x /var/www/yourapplication/yourapplication.fcgi
$ chmod +x /var/www/yourapplication/yourapplication.fcgi

Configuring Apache
------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/deploying/mod_wsgi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ follows:

.. sourcecode:: text

# apt-get install libapache2-mod-wsgi
$ apt-get install libapache2-mod-wsgi

If you are using a yum based distribution (Fedora, OpenSUSE, etc..) you
can install it as follows:

.. sourcecode:: text

# yum install mod_wsgi
$ yum install mod_wsgi

On FreeBSD install `mod_wsgi` by compiling the `www/mod_wsgi` port or by
using pkg_add:

.. sourcecode:: text

# pkg install ap22-mod_wsgi2
$ pkg install ap22-mod_wsgi2

If you are using pkgsrc you can install `mod_wsgi` by compiling the
`www/ap2-wsgi` package.
Expand Down
10 changes: 5 additions & 5 deletions docs/deploying/wsgi-standalone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Gunicorn
worker model ported from Ruby's Unicorn project. It supports both `eventlet`_
and `greenlet`_. Running a Flask application on this server is quite simple::

gunicorn myproject:app
$ gunicorn myproject:app

`Gunicorn`_ provides many command-line options -- see ``gunicorn -h``.
For example, to run a Flask application with 4 worker processes (``-w
4``) binding to localhost port 4000 (``-b 127.0.0.1:4000``)::

gunicorn -w 4 -b 127.0.0.1:4000 myproject:app
$ gunicorn -w 4 -b 127.0.0.1:4000 myproject:app

.. _Gunicorn: http://gunicorn.org/
.. _eventlet: http://eventlet.net/
Expand All @@ -35,7 +35,7 @@ which makes it more complicated to setup than gunicorn.

Running `uWSGI HTTP Router`_::

uwsgi --http 127.0.0.1:5000 --module myproject:app
$ uwsgi --http 127.0.0.1:5000 --module myproject:app

For a more optimized setup, see :doc:`configuring uWSGI and NGINX <uwsgi>`.

Expand Down Expand Up @@ -67,7 +67,7 @@ non-blocking event-driven networking library. Twisted Web comes with a
standard WSGI container which can be controlled from the command line using
the ``twistd`` utility::

twistd web --wsgi myproject.app
$ twistd web --wsgi myproject.app

This example will run a Flask application called ``app`` from a module named
``myproject``.
Expand All @@ -77,7 +77,7 @@ as well; see ``twistd -h`` and ``twistd web -h`` for more information. For
example, to run a Twisted Web server in the foreground, on port 8080, with an
application from ``myproject``::

twistd -n web --port tcp:8080 --wsgi myproject.app
$ twistd -n web --port tcp:8080 --wsgi myproject.app

.. _Twisted: https://twistedmatrix.com/
.. _Twisted Web: https://twistedmatrix.com/trac/wiki/TwistedWeb
Expand Down
34 changes: 17 additions & 17 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,28 @@ Create a project folder and a :file:`venv` folder within:

.. code-block:: sh
mkdir myproject
cd myproject
python3 -m venv venv
$ mkdir myproject
$ cd myproject
$ python3 -m venv venv
On Windows:

.. code-block:: bat
py -3 -m venv venv
$ py -3 -m venv venv
If you needed to install virtualenv because you are on an older version of
Python, use the following command instead:

.. code-block:: sh
virtualenv venv
$ virtualenv venv
On Windows:

.. code-block:: bat
\Python27\Scripts\virtualenv.exe venv
> \Python27\Scripts\virtualenv.exe venv
.. _install-activate-env:

Expand All @@ -113,13 +113,13 @@ Before you work on your project, activate the corresponding environment:

.. code-block:: sh
. venv/bin/activate
$ . venv/bin/activate
On Windows:

.. code-block:: bat
venv\Scripts\activate
> venv\Scripts\activate
Your shell prompt will change to show the name of the activated environment.

Expand All @@ -130,7 +130,7 @@ Within the activated environment, use the following command to install Flask:

.. code-block:: sh
pip install Flask
$ pip install Flask
Flask is now installed. Check out the :doc:`/quickstart` or go to the
:doc:`Documentation Overview </index>`.
Expand All @@ -143,7 +143,7 @@ update the code from the master branch:

.. code-block:: sh
pip install -U https://github.com/pallets/flask/archive/master.tar.gz
$ pip install -U https://github.com/pallets/flask/archive/master.tar.gz
.. _install-install-virtualenv:

Expand All @@ -158,27 +158,27 @@ On Linux, virtualenv is provided by your package manager:
.. code-block:: sh
# Debian, Ubuntu
sudo apt-get install python-virtualenv
$ sudo apt-get install python-virtualenv
# CentOS, Fedora
sudo yum install python-virtualenv
$ sudo yum install python-virtualenv
# Arch
sudo pacman -S python-virtualenv
$ sudo pacman -S python-virtualenv
If you are on Mac OS X or Windows, download `get-pip.py`_, then:

.. code-block:: sh
sudo python2 Downloads/get-pip.py
sudo python2 -m pip install virtualenv
$ sudo python2 Downloads/get-pip.py
$ sudo python2 -m pip install virtualenv
On Windows, as an administrator:

.. code-block:: bat
\Python27\python.exe Downloads\get-pip.py
\Python27\python.exe -m pip install virtualenv
> \Python27\python.exe Downloads\get-pip.py
> \Python27\python.exe -m pip install virtualenv
Now you can return above and :ref:`install-create-env`.

Expand Down
8 changes: 4 additions & 4 deletions docs/patterns/appfactories.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ Using Applications

To run such an application, you can use the :command:`flask` command::

export FLASK_APP=myapp
flask run
$ export FLASK_APP=myapp
$ flask run
Flask will automatically detect the factory (``create_app`` or ``make_app``)
in ``myapp``. You can also pass arguments to the factory like this::

export FLASK_APP="myapp:create_app('dev')"
flask run
$ export FLASK_APP="myapp:create_app('dev')"
$ flask run
Then the ``create_app`` factory in ``myapp`` is called with the string
``'dev'`` as the argument. See :doc:`/cli` for more detail.
Expand Down
8 changes: 4 additions & 4 deletions docs/patterns/packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ a big problem, just add a new file called :file:`setup.py` next to the inner
In order to run the application you need to export an environment variable
that tells Flask where to find the application instance::

export FLASK_APP=yourapplication
$ export FLASK_APP=yourapplication

If you are outside of the project directory make sure to provide the exact
path to your application directory. Similarly you can turn on the
development features like this::

export FLASK_ENV=development
$ export FLASK_ENV=development

In order to install and run the application you need to issue the following
commands::

pip install -e .
flask run
$ pip install -e .
$ flask run

What did we gain from this? Now we can restructure the application a bit
into multiple modules. The only thing you have to remember is the
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ should see your hello world greeting.
you can make the server publicly available simply by adding
``--host=0.0.0.0`` to the command line::

flask run --host=0.0.0.0
$ flask run --host=0.0.0.0

This tells your operating system to listen on all public IPs.

Expand Down
2 changes: 1 addition & 1 deletion docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can then use that with your favourite testing solution.
In this documentation we will use the `pytest`_ package as the base
framework for our tests. You can install it with ``pip``, like so::

pip install pytest
$ pip install pytest

.. _pytest:
https://pytest.org
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 21b0aa6

Please sign in to comment.