A couple of days ago, while browsing the Django repository on Github, I discovered the django_bash_completion script (only took me 2 years to find it). Shortly after the mind=blown moment I tested it and was amazed by the results, or rather by the fact that I never knew it existed, although it's referenced in the docs.

Installation was really simple, and outlined in the script itself:

# Testing it out without installing
# =================================
# To test out the completion without "installing" this, just run this file
# directly, like so:
#     . ~/path/to/django_bash_completion
# Note: There's a dot ('.') at the beginning of that command.
# After you do that, tab completion will immediately be made available in your
# current Bash shell. But it won't be available next time you log in.
# Installing
# ==========
# To install this, point to this file from your .bash_profile, like so:
#     . ~/path/to/django_bash_completion
# Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile.
# Settings will take effect the next time you log in.

The result:

$ python manage.py [TAB]
cleanup           diffsettings      inspectdb         runfcgi           sqlall

Since I have Django projects deployed on almost every VPS that I access, I decided to write a small script to install it on a remote machine easily.

# install_django_bash_completion.sh


mkdir $DIR
wget https://raw.github.com/django/django/master/extras/django_bash_completion -P $DIR
echo -e "\n\n#Django bash comletion:\nsource $DIR/django_bash_completion" >> ~/.bashrc

And execute it via:

cat install_django_bash_completion.sh | ssh my.server.com


  • Yes, I know that Zsh auto-completes Django management commands (and much more), but I prefer to stick with Bash for now.
  • The script is located at site-packages/django/extras when you install Django. But I wanted something more generic as it's located in different virtualenvs on every machine.

Running a Bottle app with Gunicorn

10 Jun 2012 by Yuri Prezument

Recently I wrote a simple web tracker at work, using the Bottle microframework.

Looking back, maybe I should've used Flask instead, as I simply don't see the reason for stuffing 3,000 lines of code in one file, other than a proof of concept. But both frameworks are ...

read more

Setting Up

19 May 2012 by Yuri Prezument

I decided to set up this blog mainly as an experiment.

I might write might write some Python and software dev related posts sometime soon.

This blog is powered by Pelican, the posts are written in reStructuredText and it's hosted on Github Pages.

I'm keeping the source repository ...

read more