You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.rst
+24-14Lines changed: 24 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,7 @@ To get a list of available commands and their descriptions, just run with no com
111
111
112
112
To get help text for a particular command::
113
113
114
-
python manage.py runserver -h
114
+
python manage.py runserver -?
115
115
116
116
This will print usage plus the docstring of the ``Command``.
117
117
@@ -128,9 +128,9 @@ Commands created this way are run in exactly the same way as those created with
128
128
python manage.py hello
129
129
> hello
130
130
131
-
As with the ``Command`` class, the docstring you use for the function will appear when you run with the **-h** option::
131
+
As with the ``Command`` class, the docstring you use for the function will appear when you run with the **-?** or **--help** option::
132
132
133
-
python manage.py -h
133
+
python manage.py -?
134
134
> Just say hello
135
135
136
136
Finally, the ``@option`` decorator, again belonging to ``Manager`` can be used when you want more sophisticated
@@ -142,6 +142,12 @@ control over your commands::
142
142
143
143
The ``@option`` decorator is explained in more detail below.
144
144
145
+
*New in version 2.0*
146
+
147
+
Help was previously available with **--help** and **-h**. This had a couple
148
+
of less-than-ideal consequences, among them the inability to use **-h** as
149
+
a shortcut for **--host**. If you want to restore the original meaning of
150
+
**-h**,
145
151
146
152
Adding arguments to commands
147
153
----------------------------
@@ -216,12 +222,10 @@ alternatively::
216
222
> python manage.py hello -n Joe
217
223
hello Joe
218
224
219
-
There are a couple of important points to note here.
220
-
221
-
The short-form **-n** is formed from the first letter of the argument, so "name" > "-n". Therefore it's a good idea that your
222
-
optional argument variable names begin with different letters.
225
+
The short-form **-n** is formed from the first letter of the argument, so "name" > "-n". Therefore it's a good idea for your
226
+
optional argument variable names to begin with different letters.
223
227
224
-
The second issue is that the **-h** switch always runs the help text for that command, so avoid arguments starting with the letter "h".
228
+
*New in version 2.0*
225
229
226
230
Note also that if your optional argument is a boolean, for example::
227
231
@@ -341,10 +345,16 @@ argument parser.
341
345
In order for manager options to work you must pass a factory function, rather than a Flask instance, to your
342
346
``Manager`` constructor. A simple but complete example is available in `this gist <https://gist.github.com/smurfix/9307618>`_.
343
347
344
-
*New in version 0.7.0.*
348
+
*New in version 2.0*
349
+
350
+
Before version 2, options and command names could be interspersed freely.
351
+
The author decided to discontinue this practice for a number of reasons;
352
+
the problem with the most impact was that it was not possible to do
353
+
354
+
> python manage.py connect -d DEST
355
+
> python manage.py import -d DIR
345
356
346
-
Before version 0.7, options and command names could be interspersed freely.
347
-
This is no longer possible.
357
+
as these options collided.
348
358
349
359
Getting user input
350
360
------------------
@@ -366,8 +376,8 @@ Getting user input
366
376
367
377
It then runs like this::
368
378
369
-
python manage.py dropdb
370
-
> Are you sure you want to lose all your data ? [N]
379
+
> python manage.py dropdb
380
+
Are you sure you want to lose all your data ? [N]
371
381
372
382
See the :ref:`api` below for details on the various prompt functions.
373
383
@@ -391,7 +401,7 @@ and then run the command::
391
401
392
402
python manage.py runserver
393
403
394
-
The ``Server`` command has a number of command-line arguments - run ``python manage.py runserver -h`` for details on these. You can redefine the defaults in the constructor::
404
+
The ``Server`` command has a number of command-line arguments - run ``python manage.py runserver -?`` for details on these. You can redefine the defaults in the constructor::
0 commit comments