Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-extensions - Get manage.py shell_plus to save history?

I'm using django-extensions shell_plus command, but it doesn't save the command history (i.e., does nothing). Any ideas how to fix this?

like image 937
a paid nerd Avatar asked Dec 21 '11 22:12

a paid nerd


2 Answers

I had the same problem, and running it with --use-pythonrc fixed it.

python manage.py shell_plus --use-pythonrc

If that fixes it for you, you can create a shell alias to shorten the command. Something like:

alias sp="python manage.py shell_plus --use-pythonrc"

After that, you can just type sp from the directory with manage.py in it. Personally, I put the absolute path to manage.py so I can type sp from anywhere.

Put that alias command in you .bash_profile and it will be available every time you login.

like image 175
mhost Avatar answered Sep 23 '22 07:09

mhost


It looks like shell_plus has duplicated code from the Django shell command, but it hasn't been updated to work with IPython >= 0.11. You can see the changes made in Django.

like image 27
Thomas K Avatar answered Sep 25 '22 07:09

Thomas K