AmoghDesai.com

How To Install OSQA, Python, Django On Dreamhost Shared Hosting

OSQA is a crowd-sourcing question answer forum based on Python and Django.  I do not claim this tutorial to be the best OSQA installation tutorial, but I’m sure as of today this is a better tutorial for OSQA installation on Dreamhost shared Hosting.  There are a couple of other tutorials on the web which are either stale or do not give importance to minute details and issues which come up during the installation, usually for Linux newbies.

Unlike most of the forum applications which run on PHP, OSQA runs on Python as a Django application.  Shared hosts like Dreamhost does not have OSQA as a one-click-install solution.  They do not provide root access to change/modify/install system files either. However, full access to the user profile is available hence, we install all the required applications in our user directory to setup OSQA.

So, let us start with the installation.  Things you would require are, Dreamhost shared hosting, SSH client like PuTTY and a shell account.

 

  1. Setting up your domain, user and database.

Setup Domain 

Setup User 

Setup Database 

 

  1. Login to the Shell account

 

  1. Install OSQA

There are a few things you need to remember while installing OSQA on Dreamhost shared hosting.

mkdir python

wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tar.bz2

tar -xjf Python-2.7.1.tar.bz2

cd Python-2.7.1

./configure -prefix=$HOME/python

make && make install

python -V

and you should get the version Python 2.7.1

rm -rf rm Python-2.7.1*

PATH=~/python/bin:$PATH

 

mkdir svn

wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.bz2

wget http://subversion.tigris.org/downloads/subversion-deps-1.6.15.tar.bz2

tar -xjf subversion-1.6.15.tar.bz2

tar -xjf subversion-deps-1.6.15.tar.bz2

cd subversion-1.6.15

./configure -prefix=$HOME/svn -with-expat=builtin -with-pic -with-ssl

make && make install

cd

vi .bashrc

 

PATH=~/python/bin:~/svn/bin:$PATH

source .bashrc

To install python modules you can either use easy_install or pip.  In this tutorial I have used easy_install for all the modules and pip is only used to install Django.  This is because only Django 1.3.1 works with OSQA right now and pip has the option to install specific version (which easy_install doesn’t). Lets start.

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg

sh setuptools-0.6c11-py2.7.egg

easy_install pip

easy_install flup

easy_install mysql-python

easy_install html5lib

easy_install markdown

easy_install south

easy_install python-openid

pip install django==1.3.1

 cd ~/your_domain /

svn co http://svn.osqa.net/svnroot/osqa/trunk

mv trunk osqa

cd osqa

cp settings_local.py.dist settings_local.py

vi settings_local.py

 (Important: replace “your_domain” with the domain name you created) 

DATABASE_NAME = ‘my_database’
DATABASE_USER = ‘my_user’
DATABASE_PASSWORD = ‘my_password’
DATABASE_ENGINE = ‘mysql’  #mysql, etc
DATABASE_HOST = ‘mysql.my_domain.com’
DATABASE_PORT = ” #leave empty for dreamhost

 

cd ~/your_domain/osqa

python manage.py syncdb –all

  • When it prompts for creating a user type no and hit Enter

python manage.py migrate forum –fake

 (Important: replace “your_domain” with the domain name you created)

cd ~/your_domain/

vi passenger_wsgi.py

 import sys, os
INTERP = “/home/your_shell_username/python/bin/python2.7”
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(‘/home/ your_shell_username/your_domain)
sys.path.append(‘/home/ your_shell_username/your_domain/osqa’)
os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘osqa.settings’
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

 

(Important: replace “your_domain” and “your_shell_username” with the domain name and shell userid you created). 

Pkill python

 Your OSQA installation is now complete.  Open a web browser and open your new OSQA domain name and you should be good to go !!

(Important: As soon as you log-in create a new user, your 1st user is the admin user)