Tutorials, Guides, Tips, and Tricks from Everyday Experiences

This guide will walk you through how to install and run Django on a shared host such as Bluehost. Because I use Bluehost, I was able to verify the steps you see below, but you might need to modify some of the steps to work with your specific host. The whole thing should take less than 10 minutes. If I’ve done my job right, you should be able to copy/paste multiple lines to run all commands in a block as if it were a script. If you feel more comfortable, you can run each command line by line. Let’s get to it…

Step 1: Installing Python 2.7

This step is for those of you who have an older installation of Python on your webhost. In the case of Bluehost (as of 12/6/2012), the version that is installed is 2.6.6. If you have version 2.7.0 and up (but not including version 3.0), then you can skip this step. Otherwise, follow along (you should be able to copy/paste this entire block into the terminal to run it all at once):

At this point, you should be able to run which pip successfully like this:

# which pip
/home1/user/python27/bin/pip

Step 3: Use pip to Install Modules

We’re going to install MySQL-python, flup, and Django using pip (Note: If you plan on using PosgreSQL, you’ll need to install psycopg2):

pip install Django MySQL-python flup #psycopg2

At this point, you should be able to run which django-admin.py successfully like this:

# which django-admin.py
/home1/user/python27/bin/django-admin.py

Step 4: Setup an Environment for the Project

I’m going to name the project ‘myproject’. When you go to create your own, you’ll want to replace anything called ‘myproject’ with the project name of your choice (you should be able to copy/paste this entire block into the terminal to run it all at once):

Now, visit your website at http://mydomain/myproject and you should see the Django start page! Have fun with it.

A final note: If you want to use the admin pages, you’ll need to follow a few more steps to get the page to show up properly with css, js, and images (you’ll need to replace mydomainname with your actual domain name).

Awesome! Thanks for the tip. I didn’t know you could pipe curl into python (or at least never gave it a thought).

BorgesFebruary 1st, 2014 at 11:09 am

Thanks a lot for the tutorial. It seems I almost got there already.

After doing everything with no errors, I went to check myproject URL, and the result was this:

Using the URLconf defined in myproject.urls, Django tried these URL patterns, in this order:
^admin/
The current URL, , didn’t match any of these.

What should I do next?

Thanks in advance

KateFebruary 17th, 2014 at 1:15 pm

After I use startproject and try to go to the new web page I get a (404) error, I’m running Django 1.6. Please help :/

SimoJuly 26th, 2014 at 7:28 am

I’ve faced same 404 error. Everything seems to be ok and I can run fcgi script from command line and it works fine and outputs expected html (status 200/ok) but when I try to access mysite via browser it will get 404.