Django autocomplete in (virtualenv) shell
- Create a file .pythonrc in
~/.pythonrc
# enable syntax completion
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
- Export it by adding this export to your profile file (if you use zsh, append to ~/.zprofile instead)
echo "export PYTHONSTARTUP=~/.pythonrc" >> ~/.bash_profile
Tada! After having reopened your terminal window, you should now get
autocomplete when opennig up python
Virtualenv
Want it in virutalenv? Append it to your activate file instead of your profile
echo "export PYTHONSTARTUP=$HOME/.pythonrc" >> ./env/bin/activate
Relevance of the image? “Way out” is a suggestion at a terminal! 😉
Previous postRunning Django with nginx (on webfaction)
Next Postjquery confirm modal using bootstrap