StackOverflow is a famous online Question&Answer system. People can ask questions and may get great answers from professionals. StackOverflow is quite popular with developers all over the world.
How about your own one
Isn’t it cool to have your own online Q&A system? Especially when:
- You are hosting a conference, and hope the attendees/speakers can communicate better on a dedicated platform during/after the sessions?
- You are teaching a course, and wish to get more feedbacks/questions from the audiences to improve your materials?
- You are working in a team, and wanna have an online Q&A app, so all teammates can check FAQs?
A dedicated online Q&A platform can be very useful in many scenarios.
If you got an OpenShift account, you can deploy your own one in a minute, for FREE.
Now let’s get our hands dirty by deploying the OpenSource Q&A app on OpenShift. You don’t need to pay any money or maintain any server, even don’t have to know much about programming to build it.
Latter in this blog, I’ll also talk about how to deploy the application on your local machine. We can do a little comparison then.
It is easy on OpenShift
$ rhc setup
3- Create a Python application, pick an name for it (let’s use “myqa” for example)
$ rhc app create myqa python-2.6
4- Get codes from OSQA quickstart repo
$ cd myqa $ git remote add openshift -m master git://github.com/openshift/OSQA-openshift-quickstart.git $ git pull -s recursive -X theirs openshift master
5- Add database support, then push codes to your app
$ rhc cartridge add mysql-5. $ git push
That’s it, now you can enjoy your own Q&A system at:
BTW, the first user signing up in this new Q&A app will be the admin account.
But if you wanna know, following is about how to host one on your own machine
1- Download the latest release of OSQA from http://www.osqa.net/releases/.
2- Install Python and python-setuptools.
# yum install python python-setuptools mod_wsgi
3- Next, install some Python modules.
# easy_install django markdown html5lib python-openid south
4- Now, extract OSQA
$ tar -zxvf fantasy-island-0.9.0-beta3.tar.gz $ mv fantasy-island-0.9.0-beta3 /usr/local/src/osqa
5- Make a local version of the settings file
$ cd /usr/local/src/osqa $ cp settings_local.py.dist settings_local.py
6- Then, modify it so that the lines with the following names are as shown. There will be other lines but they don’t need to be modified. Make sure you change the “APP_URL” to match your hostname.
DATABASE_NAME = '/usr/local/src/osqa/osqa.db' DATABASE_ENGINE = 'sqlite3' APP_URL = 'http://localhost:8080'
If you wanna use mysql or any other DBMS, it will need more configuration on database setting up.
7- Modify /usr/local/src/osqa/forum/utils/html.py so that the line
from django.template import mark_safe
from django.utils.safestring import mark_safe
8- And modify /usr/local/src/osqa/forum/urls.py so that
url(r'^%s(.*)' % _('nimda/'), admin.site.root),
url(r'^%s(.*)' % _('nimda/'), include(admin.site.urls)),
9- Now you’re ready to create the OSQA database tables and the OSQA administrative user. To do this, run
$ python manage.py syncdb --all
You’ll see some warning about depreciated Python features. Ignore these.
10- You’ll be asked for the name, password, and email address for the OSQA administrator. Choose ‘no’ since you can create in the website later.
11- With that command you have successfully defined the schema. With South installed, you also have the ability to migrate between databases — a useful feature as OSQA is updated. However, as this is a fresh install, you will need to convince South that the schema is already up to date by “faking” a migration. You can do that with the following command:
$ python manage.py migrate forum --fake
12- You can try to run OSQA on your local server now.
$ python manage.py runserver
It will give you an local URL of your OSQA.
Yes, it works, but … can be enjoyed by yourself only.
If you wanna publish this web app on your server to the world, you may have to install and configure Apache, virtual host and mod_wsig etc. And you need to pay extra fee for the DNS and ISP.
It’s a lot more work and cost, right?