Code

Opened 9 years ago

Closed 9 years ago

#1202 closed enhancement (fixed)

Allow "manage.py shell" to use IPython if present

Reported by: hbtaylor@… Owned by: adrian
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I cribbed the following from TurboGears. Their tg-admin.py shell command tried to import IPython and falls back to code.interact() if IPython isn't present. I prefer IPython for several reasons. I know I can run it manually if I want to, but it isn't available via a nice, easy command!

A modification like the following to "run_shell" in django.core.management seems to work (not my original work - I grabbed it from TG):

def run_shell():
    "Runs a Python interactive interpreter. Tries to run IPython if it exists"
    try:
        import IPython
        shell = IPython.Shell.IPShell()
        shell.mainloop()
    except ImportError:
        import code
        code.interact()

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [1930]) Fixed #1202 -- Changed 'manage.py shell' to use IPython if present. Also added '--plain' option, which overrides IPython to use the standard Python interactive prompt

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.