diff --git a/django/core/management/commands/shell.py b/django/core/management/commands/shell.py
index 9616902..236a916 100644
a
|
b
|
class Command(NoArgsCommand):
|
11 | 11 | |
12 | 12 | requires_model_validation = False |
13 | 13 | |
| 14 | def ipython(self): |
| 15 | import IPython |
| 16 | # Explicitly pass an empty list as arguments, because otherwise IPython |
| 17 | # would use sys.argv from this script. |
| 18 | shell = IPython.Shell.IPShell(argv=[]) |
| 19 | shell.mainloop() |
| 20 | |
| 21 | def bpython(self): |
| 22 | import bpython |
| 23 | bpython.embed() |
| 24 | |
| 25 | def smart_shell(self): |
| 26 | shells = ('ipython', 'bpython') |
| 27 | for shell in shells: |
| 28 | try: |
| 29 | return getattr(self, shell)() |
| 30 | except ImportError: |
| 31 | pass |
| 32 | raise ImportError |
| 33 | |
14 | 34 | def handle_noargs(self, **options): |
15 | 35 | # XXX: (Temporary) workaround for ticket #1796: force early loading of all |
16 | 36 | # models from installed apps. |
… |
… |
class Command(NoArgsCommand):
|
23 | 43 | if use_plain: |
24 | 44 | # Don't bother loading IPython, because the user wants plain Python. |
25 | 45 | raise ImportError |
26 | | import IPython |
27 | | # Explicitly pass an empty list as arguments, because otherwise IPython |
28 | | # would use sys.argv from this script. |
29 | | shell = IPython.Shell.IPShell(argv=[]) |
30 | | shell.mainloop() |
| 46 | self.smart_shell() |
31 | 47 | except ImportError: |
32 | 48 | import code |
33 | 49 | # Set up a dictionary to serve as the environment for the shell, so |
diff --git a/docs/man/django-admin.1 b/docs/man/django-admin.1
index ce3fdb1..4a459fd 100644
a
|
b
|
for help on the KEY=val pairs.
|
65 | 65 | Starts a lightweight Web server for development. |
66 | 66 | .TP |
67 | 67 | .BI "shell [" "\-\-plain" "]" |
68 | | Runs a Python interactive interpreter. Tries to use IPython, if it's available. |
| 68 | Runs a Python interactive interpreter. Tries to use IPython or bpython if either is available. |
69 | 69 | The |
70 | 70 | .BI \-\-plain |
71 | | option forces the use of the standard Python interpreter even when IPython is |
| 71 | option forces the use of the standard Python interpreter even if IPython or bpython is |
72 | 72 | installed. |
73 | 73 | .TP |
74 | 74 | .BI "sql [" "appname ..." "]" |
… |
… |
Lets you manually add a directory the Python path,
|
131 | 131 | e.g. "/home/djangoprojects/myproject". |
132 | 132 | .TP |
133 | 133 | .I \-\-plain |
134 | | Use plain Python, not IPython, for the "shell" command. |
| 134 | Use plain Python, not IPython or bpython, for the "shell" command. |
135 | 135 | .TP |
136 | 136 | .I \-\-noinput |
137 | 137 | Do not prompt the user for input. |
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 67b1b6c..0ed1396 100644
a
|
b
|
shell
|
623 | 623 | |
624 | 624 | Starts the Python interactive interpreter. |
625 | 625 | |
626 | | Django will use IPython_, if it's installed. If you have IPython installed and |
627 | | want to force use of the "plain" Python interpreter, use the ``--plain`` |
628 | | option, like so:: |
| 626 | Django will use IPython_ or bpython_ if either is installed. If you have a |
| 627 | rich shell installed but want to force use of the "plain" Python interpreter, |
| 628 | use the ``--plain`` option, like so:: |
629 | 629 | |
630 | 630 | django-admin.py shell --plain |
631 | 631 | |
632 | 632 | .. _IPython: http://ipython.scipy.org/ |
| 633 | .. _bpython: http://bpython-interpreter.org/ |
633 | 634 | |
634 | 635 | sql <appname appname ...> |
635 | 636 | ------------------------- |