Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable history in Django shell in python

I am using Django shell_plus.

The readline and rlcompleter modules are installed in there.

But i find that when i close my shell_plus session then i can go back to history commands which i used in previous sessions.

In my office i can go back to previous commands as well.

what do i need to do for that

like image 203
user1958218 Avatar asked Jun 29 '13 06:06

user1958218


People also ask

What does the Django command manage PY shell do?

In addition, manage.py is automatically created in each Django project. It does the same thing as django-admin but also sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project's settings.py file.


2 Answers

You could use bpython it has history enabled and many other fantastic features, if you are using virtualenv install it with pip.

pip install bpython

or globally

apt-get install bpython

For me this is the most amazing interactive shell for python.

like image 50
Arnold Gandarillas Avatar answered Nov 02 '22 23:11

Arnold Gandarillas


Do you have IPython installed?

The docs mention that

The default resolution order is: bpython, ipython, python.

P.S. I haven't used bpython but there seems to be a history too.

like image 6
arie Avatar answered Nov 02 '22 21:11

arie