Skip to content

Commit

Permalink
Fixed #14187 -- Added support for bpython to shell management command…
Browse files Browse the repository at this point in the history
…. Thanks, Jeremy Dunck.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jezdez committed Dec 12, 2010
1 parent 47a5153 commit 05eb536
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion django/core/management/commands/shell.py
Expand Up @@ -8,7 +8,7 @@ class Command(NoArgsCommand):
help='Tells Django to use plain Python, not IPython.'),
)
help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available."
shells = ['ipython']
shells = ['ipython', 'bpython']
requires_model_validation = False

def ipython(self):
Expand All @@ -28,6 +28,10 @@ def ipython(self):
# IPython not found at all, raise ImportError
raise

def bpython(self):
import bpython
bpython.embed()

def run_shell(self):
for shell in self.shells:
try:
Expand Down
7 changes: 4 additions & 3 deletions docs/ref/django-admin.txt
Expand Up @@ -747,13 +747,14 @@ shell

Starts the Python interactive interpreter.

Django will use IPython_, if it's installed. If you have IPython installed and
want to force use of the "plain" Python interpreter, use the ``--plain``
option, like so::
Django will use IPython_ or bpython_ if either is installed. If you have a
rich shell installed but want to force use of the "plain" Python interpreter,
use the ``--plain`` option, like so::

django-admin.py shell --plain

.. _IPython: http://ipython.scipy.org/
.. _bpython: http://bpython-interpreter.org/

sql <appname appname ...>
-------------------------
Expand Down

0 comments on commit 05eb536

Please sign in to comment.