Created
September 30, 2014 19:14
-
-
Save defrex/f4bedd533f7ff1a2c0a8 to your computer and use it in GitHub Desktop.
Add ptpython support to Django's shell command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management.commands.shell import Command as ShellCommand | |
class Command(ShellCommand): | |
shells = ['ptpython', 'ipython', 'bpython'] | |
def ptpython(self): | |
from prompt_toolkit.contrib.repl import embed | |
embed(globals(), locals(), vi_mode=False, history_filename=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, you can do this:
django_admin$ pip install django-extensions
Append
django_extensions
(note the underscore this time) to theINSTALLED_APPS
variable insettings.py
(or whatever python file you use for Django settings).Finally:
django_admin$ python ./manage.py shell_plus [--settings settings.py]