Django includes a Bash shell completion script, which can save a lot of time. The tutorial recommends installing it, but doesn’t explain how. Fortunately, its the same as for any other Bash shell completion script. Here’s how I did it for Django.
- Add an environment variable for the location where you installed Django. For example, add the following line to ~/.bash_profile:
- Add a line after this one in ~/.bash_profile to read the script, e.g.,
- After saving .bash_profile, open a new terminal or run
Now, you can press tab to complete commands. Below, I pressed tab after entering “manage.py”.
$ python manage.py compilemessages diffsettings loaddata runserver sqlclear sqlreset syncdb createcachetable dumpdata makemessages shell sqlcustom sqlsequencereset test createsuperuser flush reset sql sqlflush startapp validate dbshell inspectdb runfcgi sqlall sqlindexes startproject