Last active
April 7, 2018 16:17
-
-
Save jpadilla/6022163 to your computer and use it in GitHub Desktop.
export PYTHONSTARTUP=$HOME/.python-startup.py
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
import os | |
import readline | |
import rlcompleter | |
import atexit | |
history_file = os.path.join(os.environ['HOME'], '.python_history') | |
try: | |
readline.read_history_file(history_file) | |
except IOError: | |
pass | |
# Turn on Autocomplete | |
readline.parse_and_bind("tab: complete") | |
# Limit the number of entries saved | |
readline.set_history_length(1000) | |
# Create history file on exit if it doesn't already exist | |
atexit.register(readline.write_history_file, history_file) | |
# Remove all variables | |
del os, readline, rlcompleter, atexit, history_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be used with Django shell_plus:
python manage.py shell_plus --use-pythonrc