Skip to content

Commit 21b0aa6

Browse files
greylilepture
authored andcommitted
Add prefix for all commands in documentation (pallets#2877)
* Add prefix for commands in docs * Add prefix for commands in example's README
1 parent b9b88b0 commit 21b0aa6

19 files changed

+112
-112
lines changed

docs/cli.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ command, instead of ``flask run --port 8000``:
195195

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

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

224224
.. code-block:: none
225225
226-
export FLASK_SKIP_DOTENV=1
227-
flask run
226+
$ export FLASK_SKIP_DOTENV=1
227+
$ flask run
228228
229229
230230
Environment Variables From virtualenv
@@ -236,11 +236,11 @@ script. Activating the virtualenv will set the variables.
236236

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

239-
export FLASK_APP=hello
239+
$ export FLASK_APP=hello
240240

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

243-
set FLASK_APP=hello
243+
> set FLASK_APP=hello
244244

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

269269
::
270270

271-
flask create_user admin
271+
$ flask create_user admin
272272

273273
This example adds the same command, but as ``user create``, a command in a
274274
group. This is useful if you want to organize multiple related commands. ::
@@ -289,7 +289,7 @@ group. This is useful if you want to organize multiple related commands. ::
289289

290290
::
291291

292-
flask user create demo
292+
$ flask user create demo
293293

294294
See :ref:`testing-cli` for an overview of how to test your custom
295295
commands.

docs/config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ The following configuration values are used internally by Flask:
164164
application. It should be a long random string of bytes, although unicode
165165
is accepted too. For example, copy the output of this to your config::
166166

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

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

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

422-
>set YOURAPPLICATION_SETTINGS=\path\to\settings.cfg
422+
> set YOURAPPLICATION_SETTINGS=\path\to\settings.cfg
423423

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

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

458-
>set SECRET_KEY='5f352379324c22463451387a0aec5d2f'
459-
>set DEBUG=False
458+
> set SECRET_KEY='5f352379324c22463451387a0aec5d2f'
459+
> set DEBUG=False
460460

461461
While this approach is straightforward to use, it is important to remember that
462462
environment variables are strings -- they are not automatically deserialized

docs/deploying/fastcgi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ can execute it:
4949

5050
.. sourcecode:: text
5151

52-
# chmod +x /var/www/yourapplication/yourapplication.fcgi
52+
$ chmod +x /var/www/yourapplication/yourapplication.fcgi
5353

5454
Configuring Apache
5555
------------------

docs/deploying/mod_wsgi.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ follows:
2727

2828
.. sourcecode:: text
2929

30-
# apt-get install libapache2-mod-wsgi
30+
$ apt-get install libapache2-mod-wsgi
3131

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

3535
.. sourcecode:: text
3636

37-
# yum install mod_wsgi
37+
$ yum install mod_wsgi
3838

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

4242
.. sourcecode:: text
4343

44-
# pkg install ap22-mod_wsgi2
44+
$ pkg install ap22-mod_wsgi2
4545

4646
If you are using pkgsrc you can install `mod_wsgi` by compiling the
4747
`www/ap2-wsgi` package.

docs/deploying/wsgi-standalone.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Gunicorn
1515
worker model ported from Ruby's Unicorn project. It supports both `eventlet`_
1616
and `greenlet`_. Running a Flask application on this server is quite simple::
1717

18-
gunicorn myproject:app
18+
$ gunicorn myproject:app
1919

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

24-
gunicorn -w 4 -b 127.0.0.1:4000 myproject:app
24+
$ gunicorn -w 4 -b 127.0.0.1:4000 myproject:app
2525

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

3636
Running `uWSGI HTTP Router`_::
3737

38-
uwsgi --http 127.0.0.1:5000 --module myproject:app
38+
$ uwsgi --http 127.0.0.1:5000 --module myproject:app
3939

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

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

70-
twistd web --wsgi myproject.app
70+
$ twistd web --wsgi myproject.app
7171

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

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

8282
.. _Twisted: https://twistedmatrix.com/
8383
.. _Twisted Web: https://twistedmatrix.com/trac/wiki/TwistedWeb

docs/installation.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,28 @@ Create a project folder and a :file:`venv` folder within:
8181

8282
.. code-block:: sh
8383
84-
mkdir myproject
85-
cd myproject
86-
python3 -m venv venv
84+
$ mkdir myproject
85+
$ cd myproject
86+
$ python3 -m venv venv
8787
8888
On Windows:
8989

9090
.. code-block:: bat
9191
92-
py -3 -m venv venv
92+
$ py -3 -m venv venv
9393
9494
If you needed to install virtualenv because you are on an older version of
9595
Python, use the following command instead:
9696

9797
.. code-block:: sh
9898
99-
virtualenv venv
99+
$ virtualenv venv
100100
101101
On Windows:
102102

103103
.. code-block:: bat
104104
105-
\Python27\Scripts\virtualenv.exe venv
105+
> \Python27\Scripts\virtualenv.exe venv
106106
107107
.. _install-activate-env:
108108

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

114114
.. code-block:: sh
115115
116-
. venv/bin/activate
116+
$ . venv/bin/activate
117117
118118
On Windows:
119119

120120
.. code-block:: bat
121121
122-
venv\Scripts\activate
122+
> venv\Scripts\activate
123123
124124
Your shell prompt will change to show the name of the activated environment.
125125

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

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

144144
.. code-block:: sh
145145
146-
pip install -U https://github.com/pallets/flask/archive/master.tar.gz
146+
$ pip install -U https://github.com/pallets/flask/archive/master.tar.gz
147147
148148
.. _install-install-virtualenv:
149149

@@ -158,27 +158,27 @@ On Linux, virtualenv is provided by your package manager:
158158
.. code-block:: sh
159159
160160
# Debian, Ubuntu
161-
sudo apt-get install python-virtualenv
161+
$ sudo apt-get install python-virtualenv
162162
163163
# CentOS, Fedora
164-
sudo yum install python-virtualenv
164+
$ sudo yum install python-virtualenv
165165
166166
# Arch
167-
sudo pacman -S python-virtualenv
167+
$ sudo pacman -S python-virtualenv
168168
169169
If you are on Mac OS X or Windows, download `get-pip.py`_, then:
170170

171171
.. code-block:: sh
172172
173-
sudo python2 Downloads/get-pip.py
174-
sudo python2 -m pip install virtualenv
173+
$ sudo python2 Downloads/get-pip.py
174+
$ sudo python2 -m pip install virtualenv
175175
176176
On Windows, as an administrator:
177177

178178
.. code-block:: bat
179179
180-
\Python27\python.exe Downloads\get-pip.py
181-
\Python27\python.exe -m pip install virtualenv
180+
> \Python27\python.exe Downloads\get-pip.py
181+
> \Python27\python.exe -m pip install virtualenv
182182
183183
Now you can return above and :ref:`install-create-env`.
184184

docs/patterns/appfactories.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ Using Applications
9191

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

94-
export FLASK_APP=myapp
95-
flask run
94+
$ export FLASK_APP=myapp
95+
$ flask run
9696
9797
Flask will automatically detect the factory (``create_app`` or ``make_app``)
9898
in ``myapp``. You can also pass arguments to the factory like this::
9999

100-
export FLASK_APP="myapp:create_app('dev')"
101-
flask run
100+
$ export FLASK_APP="myapp:create_app('dev')"
101+
$ flask run
102102
103103
Then the ``create_app`` factory in ``myapp`` is called with the string
104104
``'dev'`` as the argument. See :doc:`/cli` for more detail.

docs/patterns/packages.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ a big problem, just add a new file called :file:`setup.py` next to the inner
6161
In order to run the application you need to export an environment variable
6262
that tells Flask where to find the application instance::
6363

64-
export FLASK_APP=yourapplication
64+
$ export FLASK_APP=yourapplication
6565

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

70-
export FLASK_ENV=development
70+
$ export FLASK_ENV=development
7171

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

75-
pip install -e .
76-
flask run
75+
$ pip install -e .
76+
$ flask run
7777

7878
What did we gain from this? Now we can restructure the application a bit
7979
into multiple modules. The only thing you have to remember is the

docs/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ should see your hello world greeting.
8585
you can make the server publicly available simply by adding
8686
``--host=0.0.0.0`` to the command line::
8787

88-
flask run --host=0.0.0.0
88+
$ flask run --host=0.0.0.0
8989

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

docs/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You can then use that with your favourite testing solution.
1818
In this documentation we will use the `pytest`_ package as the base
1919
framework for our tests. You can install it with ``pip``, like so::
2020

21-
pip install pytest
21+
$ pip install pytest
2222

2323
.. _pytest:
2424
https://pytest.org

docs/tutorial/database.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Run the ``init-db`` command:
204204

205205
.. code-block:: none
206206
207-
flask init-db
207+
$ flask init-db
208208
Initialized the database.
209209
210210
There will now be a ``flaskr.sqlite`` file in the ``instance`` folder in

0 commit comments

Comments
 (0)