Ubuntu offers auto-completion for terminal commands by default. But there is no auto-completion for django management commands. In other words manage.py commands.

Django offers code to add this feature in your system. We just need to install it. Great. How do we do that? Don't worry. Here are the steps to do that.

Versions Used

  • Django - 1.4.x, 1.5.x, 1.6.x
  • Ubuntu - 12.04, 14.04

Step 1: Download the script from django

Use the following command to download the script from django repository as a file in your home folder

wget -O ~/.django_bash_completion.sh https://raw.github.com/django/django/master/extras/django_bash_completion

Step 2: Modify bashrc

Add the following line the .bashrc file in your home folder

source $HOME/.django_bash_completion.sh

Step 3: Load latest bashrc

Load the latest bashrc profile in your terminal using the command

source ~/.bashrc

Now the auto-complete will work for django management commands such as runserver, syncdb, shell, etc., Feel free to post your comments.