Install Django on Bluehost shared hosting

In this series, I will tell you how to install several development tools on Bluehost shared hosting. Why need to purchase a VPS or dedicated hosting if your site is small, and you can install almost everything on Bluehost shared hosting. Take a look at Install git on Bluehost shared hosting to see how I managed to install git on Bluehost. Pretty easy.

Bluehost support 2 versions of Python: 2.4 (default) and 2.6. Type python in command line and you will get Python 2.4. In order to run python script with Python 2.6, you have to type python2.6 instead.

  1. First, you have to specify where to install Django python package — it must be inside your home directory because everything else outside this directory (not everything actually, you can write in /tmp also, but who want to put their file into /tmp?) is read-only. My case is ~/.local/lib/python2.6/site-packages/
  2. Download the latest tarball from Django official site (latest version at the time of writing this entry is 1.2.4) and extract it
wget http://www.djangoproject.com/download/1.2.4/tarball/
tar -xzf Django-1.2.4.tar.gz
cd Django-1.2.4
  1. Install Django is pretty easy. Type the following line into command line window:
python2.6 setup.py install --user
  1. Add the following line to .bashrc inside your home directory. Logout and login again after that.
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

All done. You can test your Django installation by typing python at the command prompt and hit Enter. You’ll get the Python interactive interpreter, where you can type import django and hit enter. If it gives an error, then there is a problem with your installation. If no error is given, then you have successfully installed Django to your Python path. Go ahead and exit the Python shell by typing Ctrl+D.