How to Install Python, SVN, Django, OSQA on your Web Hosting Server (HostMonster, DreamHost, BlueHost, GoDaddy, HostGator)

by Keshav Gupta · 10 comments

in Software, Tutorials and Solutions

In this tutorial I will show you how did I setup OSQA(Open Source Question Answer) on my shared HostMonster hosting. This tutorial should also be valid for most of the other shared hosting environments like DreamHost, HostGator, BlueHost, GoDaddy etc. As the method shown here is very generic.

If you have any issues please post below OR you can use My Services to handle all of this.

OSQA (Open Source Question Answer forum) runs as a Django application. Django runs on Python. Though HostMonster have Python installed but it is an older version, and you don’t have the privilege to install new python packages. So we will install our own Python in this tutorial.


  1. A Reliable Web Hosting (DREAMHOST – Use Promo Code “BESTDISCOUNT2011” for a whopping $47 Discount!)
  2. You need Shell/SSH access to your hosting server. Contact your web hosting support for same.
  3. Putty Client

Procedure to Install OSQA, Django, Python, SVN on your HostMonster shared web hosting account. (Should be valid for other web hosting servers also)

  1. First Login to your SSH Client(Putty) using your credentials.
  2. Python
    Create a directory named “python” where your Python executable will reside.
    mkdir python

    Now download ,extract, compile and then install the source for Python 2.7.1 (We are not using Python 3.1 because currently Django does not support Python 3 and won’t for at least a year)

    tar -xjf Python-2.7.1.tar.bz2
    cd Python-2.7.1
    ./configure -prefix=$HOME/python
    make –j8 && make install

    make –j8 will speed up building as it will be executed in 8 concurrent threads.
    Now check if Python was installed perfectly


    Python 2.7.1 (r271:86832, Jan 16 2011, 06:48:41)
    [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> exit()

    If above message is displayed then your python installation is fine. You can now remove the sources.

    rm Python-2.7.1.tar.bz2
    rm -rf Python-2.7.1/

    Now add the Python executable to the $PATH ,so that preference to our newly installed Python is given and can be accessed from anywhere easily.

    pico .bashrc

    Pico text editor will open the .bashrc file, and at the end of the file add the following line


    Then save the file by Ctrl + O and then Ctrl + X

    After saving the file you need to reload the .bashrc file by
    source .bashrc

  3. SVN
    Now it’s time for Subversion. You install subversion in second place because it will build a python extension. The first step, as before, is to download, unpack and create a destination directory:
    mkdir svn
    tar -xjf subversion-1.6.15.tar.bz2
    tar -xjf subversion-deps-1.6.15.tar.bz2

    Now configure, make and install svn in the directory we created.

    cd subversion-1.6 .15
    ./configure -prefix=$HOME/svn -with-expat=builtin -with-pic -with-ssl
    make && make install

    To check if SVN was installed successfully.

    ./svn/bin/svn --version

    svn, version 1.6.15 (r1038135)
    compiled Jan 16 2011, 07:18:45

    Now add the SVN executable to the $PATH ,as we did with Python executable

    pico .bashrc

    Pico text editor will open the .bashrc file, and at the end of the file add the following line


    Then save the file by Ctrl + O and then Ctrl + X

    After saving the file you need to reload the .bashrc file again by
    source .bashrc

  4. Python Modules and Packages
    Now we will install Python modules and packages like setuptools : easy_install, flup, MySQL-python, Django. First of all we will install setuptools as it will make installing flup and MySQL-python easy.

    sh setuptools-0.6c11-py2.7.egg

    Now as Setuptools: easy_install is installed, lets proceed installing Django and other dependencies

    easy_install flup
    easy_install mysql-python
    easy_install Django
    easy_install html5lib
    easy_install markdown
    easy_install south
    easy_install python-openid

  5. OSQA
    Now Lets install OSQA or Open Source Question Answer on your server. First of all we will download the svn version of OSQA.
    svn co
    mv trunk osqa
    cd osqa

    Now will open in Pico editor, Now enter the Database Name and database user details and save the file by Ctrl + O and Ctrl +X

    Now that you have filled the database details, you need to prepare the Database by:

    cd ~/osqa
    python syncdb –all
    python migrate forum --fake

    Enter NO when prompted to create a new user

    Now create a directory in public_html or www , where you want your domain to refer to. Like I have created myosqa in public_html where I have referred the to

    cd public_html
    mkdir myosqa

    Now create .htaccess file and enter the following in the .htaccess file in this directory

    pico .htaccess

    AddHandler fcgid-script .fcgi  # For security reasons, Option followsymlinks cannot be overridden.
    #Options +FollowSymLinks
    Options +SymLinksIfOwnerMatch
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(media/.*)$ - [L]
    RewriteRule ^(adminmedia/.*)$ - [L]
    RewriteCond %{REQUEST_URI} !(osqa.fcgi)
    RewriteRule ^(.*)$ osqa.fcgi/$1 [L]

    Save the .htaccess by Ctrl + O and Ctrl + X

    Now create a file named osqa.fcgi and add the following code in it with changes as per your server like username, directory structure etc.

    pico osqa.fcgi

    #!/home/your_username/python/bin/python  import os, sys
    sys.path.insert(0, "/home/your_username/")
    os.environ['DJANGO_SETTINGS_MODULE'] = "osqa.settings"
    from django.core.servers.fastcgi import runfastcgi
    runfastcgi(method="threaded", daemonize="false")

    Save the osqa.fcgi by Ctrl + O and Ctrl + X

    Make osqa.fcgi executable by

    chmod +x osqa.fcgi

    Now as everything is setup, In your cpanel set a sub-domain or main domain where you want your osqa site to sit at, redirect to the folder ~/public_html/myosqa

And you are ready to go!

Note: Restarting the spawned server
If you change any Python code , or settings of osqa on your site, you’ll need to tell FastCGI the code has changed. You can do this by touching the fcgi file and the Django application will restart.
touch ~/public_html/myosqa/osqa.fcgi

{ 10 comments… read them below or add one }

1 Tyler January 29, 2011 at 7:49 am

You are my hero, dude. I finally got around to getting shell access to find that the latest version of Python HostMonster has is Python 2.4. Yuck. Props.


2 George February 5, 2011 at 7:56 pm

Thank you! What a clear description. This article is perfect.


3 mxl June 8, 2011 at 1:23 am

Hi i tried it with hostgator and it didnt work. do you know of anyone who has successfully done it on hostgator? thank you.


4 Ashis June 25, 2011 at 5:35 am

Thank you for this helpful article. I did this on my DreamHost server. I skipped the SVN installation, because I wanted to install the official “stable” release of OSQA. May be that’s why a couple of errors showed up, but I fixed them with the solution I found on the OSQA site.
Thanks again!


5 Akshay Jain August 22, 2011 at 4:35 pm

hello sir,

i want it to install. but i have no knwledge of all these. i have linux hosting. so please if you can help me.


6 Engin Gürelli July 1, 2012 at 10:59 pm

One of the best article for me as a beginner of django. Thank you Keshav.


7 bassrehab September 24, 2013 at 5:30 pm

in the osqa.fcgi,

be sure to write the “import os, sys” in a new line, python is fussy abt indentations (i kept getting 500 Internal server error)


import os, sys

sys.path.insert(0, “/home/your_username/”)

os.environ[‘DJANGO_SETTINGS_MODULE’] = “osqa.settings”

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method=”threaded”, daemonize=”false”)


also, u can always check that django and osqa is properly setup or not by first trying a development server (if u are unsure of the fcgi mod or misformed htaccess errors) by running in ur OSQA trunk…

according to this example:[/home/osqa] python runserver yourdomain

then go on and visit (u wrote above) to see if u see osqa working.

you can also use your IP address instead of
to tes ton port 80, u need sudo-powers.

Hope this helps.

This was a nice article, thanks Keshav ji.


8 Amby October 28, 2013 at 12:08 am

Hello! I could follow most steps but I am unable to install setup-tools. I am installing on a distributed computer cluster and getting this error:

ERROR: certificate common name `*’ doesn’t match requested host name `’.
Unable to establish SSL connection.

Please help!


9 m1st0 January 8, 2014 at 12:58 am

I used git to get an OSQA version that was compatible with Django 1.6 on Dreamhost.

git clone

In any case, when setting this all up I get a 500 internal server response with the following in the Apache error log:

[time] [error] [client *ip address*] Premature end of script headers: osqa.fcgi

Something I need to update?


10 Shabbir Ahmed November 25, 2015 at 9:39 am

How can i install in my local wamp server ?

Please help.


Leave a Comment

Previous post:

Next post: