2
1

Am developing a CMS with Wordpress and need a Q&A website to compliment it.

My host is BlueHost.
The install guide is not as verbose as I need, and I have spent a whole day struggling to get things moving.

  • I got BlueHost to grant me SSH access, and switched it to use FastCGI
  • Installed Django with help from this link
  • Can run python2.6 and import django works.
  • Installed easy_install, and followed this up with installing as per the instructions here.
  • Choose SpatialLite as opposed to MySQL, will switch this over if I can get things up and running.
  • python2.6 manage.py runserver then gives me a 500 internal server error.

I thought it would be easier to screencast my problem, which can be watched here.

All I want is to be confident that I have a clean + stable install.
After that, I just want to make some minor style changes (header area) which should be fine as I am ok with CSS/HTML/PHP.

This may sound lazy, but in all truth, this looks like its beyond my skillset and unless you can spot something basic that I have missed, I imagine I am still a long way off getting this up and running.
- Anyone here with good experience on installing OSQA in a Bluehost (or similar) environment? If so, would you be interested in doing this for me for either a donation to this website, or direct money? It would be coming out of my pocket, so will be more of a token of gratitude. Alternatively, I can help you with some web-GIS?

EDIT - answered Qs in comments. Once resolved, I will tidy this all up Found this link which has slight variations in the htaccess file. I copied these changes, but still ended up with a 500 error. My htaccess file. My osqa.fcgi file

  1. Dont think i have access to Root through SSH, so error logs come from cPanel. Time-20:48 was when I had made changes and was getting 500 errors.

  2. Can still hit main site at dekho.com.au, when these lines are in htaccess:

    AddHandler fcgid-script .fcgi
    RewriteEngine On
    RewriteRule ^(media.)$ /$1 [QSA,L,PT]
    RewriteCond %{REQUEST_FILENAME} !-f

Its only when I uncomment:

RewriteRule ^(.*)$ /osqa.fcgi/$1 [QSA,L]

That I get the 500 error.

  1. Have tried both. Both=500

  2. http://www.dekho.com.au/osqa.fcgi = 500 error

  3. No. See #2.

Any ideas on how to proceed? Let me know if you want me to screencast anything.

asked 13 Apr '11, 02:35

Simon's gravatar image

Simon
28692929
accept rate: 0%

edited 15 Apr '11, 23:22

Hi Simon, I've never used Bluehost, but it looks a reasonable installation. What timezone are you in - I'm in GMT+1, and might be able to help you out, if we can fix a time which will be convenient for both of us, and we can do the installation together, using skype or something to liaise.

(13 Apr '11, 03:12) Andrew_S ♦

Im in Melbourne, 9hrs ahead of you, but I am mainly working on this at nights anyhow. I have gmail chat/talk - simon.robin.jackson, but can sort my skype out if you want? Really appreciate this, who are you?

(13 Apr '11, 05:20) Simon

I'm an academic at UCL, a director of a consultancy - http://londonanalytics.info/ http://energynumbers.info/ , and a programmer. Take the first of those two domains, and email me - andrew at ... , once you've got your ssh access

(13 Apr '11, 05:26) Andrew_S ♦
1

ok, had chance to look a the screencast - looks like the server is choking on your changes to .htaccess

1) in your apache error log (/var/log/error_log or ~/logs/apache2/error_log or something) - there should be a specific report on what exactly in the rewrite rule is choking it.

2) If you just comment out one of the two lines, does the server at least serve a page? Try one, then the other.

3) Does creativitycloud.fcgi need a "/" in front of it?

4) If, when the server is working, you directly try to browse to creativitycloud.fcgi , does that work?

5) if you comment out all your other rewrite rules / conds apart from the osqa ones, does the server work?

(15 Apr '11, 15:16) Andrew_S ♦

Ill run through them now. Another thought. Should I be setting up a sub-domain to do this one? I was reading on other posts, that OSQA is a pain to setup in a folder beneath public_HTML - lots of links need updating?

(15 Apr '11, 19:58) Simon

Yes, if I served to a sub-directory, I found it hard to get all the links right. Most were, but some weren't.

So I'd say: don't have osqa served to a URL like: http://mydomain.com.au/answers/ . Instead, (if your hosting service permits it), serve it to something like: http://answers.mydomain.com.au/

(16 Apr '11, 01:25) Andrew_S ♦
showing 5 of 6 show 1 more comments

Here's roughly what I did: this can go into the wiki: This is a merge of https://www.bluehost.com/cgi/help/000531 and http://wiki.osqa.net/display/docs/Installing+OSQA+on+BlueHost+Using+fast-cgi

Go to CPanel, and create a subdirectory of your public_html - I'll call it osqa here, you call it what you like. So we've now got ~/public\\_html/osqa. Now create a subdomain in CPanel that is served from public\\_html/osqa . I'll use example.com as the domain, and osqa.example.com as the subdomain. Just don't try to use a subdirectory. Bite the bullet, make a subdomain.

Find out the right version number of Django to use. I think 1.2.4 is ok. Check the latest in the 1.2 or x.x stream, check other questions about django versions here.

Then login by SSH Replace the link in the following line, with the download link of the tarball of the django version you want - let's call it 1.2.X for now:

mkdir -p ~/.local/lib/python/
wget http://www.djangoproject.com/download/1.2.X/tarball/
tar xzvf Django-1.2X.tar.gz
cd Django-1.2.X
python2.6 setup.py install --home $HOME/.local

Note the "." in front of local each time - we are installing to ~/.local , not to ~/local

And you see that python2.6? That's really important. Anywhere you're directed to run a python command from the command line during installation, use python2.6, rather than just python.

Add the following to the end of your ~/.bashrc file:

export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH
export PYTHONPATH=$HOME/.local/lib/python2.6:$PYTHONPATH

Log out of SSH, and log back in, to make this change have effect.

This next bit is taken almost verbatim from https://www.bluehost.com/cgi/help/000531 , with a couple of important changes.

You can test your installation of Django to see if it worked by starting the Python interpretor by typing python2.6 at the command prompt and hitting enter. You'll get the Python interactive interpretor, 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've successfully installed Django to your Python path. Go ahead and exit the Python shell by typing ctrl+d.

If you were unable to import Django, try re-logging in to your shell, and try again. If it still doesn't work, double check to make sure that your Python path is correct, and that Django really resides in a directory on the Python Path. To see what this list of directories is, enter python2.6, and type "import sys; sys.path", and press enter. This should give you a list of directories. This should include any directories you listed in your .bashrc file for PYTHONPATH. Ctrl-D to exit python again.

Check for any typos in your .bashrc file. As long as the django directory is in one of those directories listed, then you should be able to do the import. If it isn't in any of those directories, try re-installing Django.

From the SSH command prompt (not the Python one, the SSH shell one), enter django-admin.py. You should get a usage message with a list of management commands that can be run. If you get "command not found", then there was a problem with the installation of Django.

To diagnose a "command not found", double check that there are no typos in your .bashrc file for the PATH variable that you added. Re-log in to ensure that this .bashrc change is taking place. Type echo $PATH at the command prompt to get a list of directories on your path, and echo $PYTHONPATH to check the Python path (but you guessed that from the name, right?). The django-admin.py file should be in your ~/.local/bin directory. If it isn't in that directory, try re-installing Django.

OK, so now you've got a working Django - you need some extra python libraries. Go get the latest setuptools from one of the links at http://pypi.python.org/pypi/setuptools#downloads Put it on your server, in a temporary directory. Then, in SSH, go to that directory, and run the following commands in turn: (replace the setuptools-XXX.egg bit in the first command, with the exact name of the setuptools file that you downloaded)

./setuptools-0.6c11-py2.6.egg --prefix=~/.local
~/.local/bin/easy_install --prefix=~/.local flup
~/.local/bin/easy_install --prefix=~/.local mysql-python
~/.local/bin/easy_install --prefix=~/.local Django
~/.local/bin/easy_install --prefix=~/.local html5lib
~/.local/bin/easy_install --prefix=~/.local markdown
~/.local/bin/easy_install --prefix=~/.local south
~/.local/bin/easy_install --prefix=~/.local python-openid

Now we install OSQA:

cd ~/.local/lib/python2.6/site-packages
svn co http://svn.osqa.net/svnroot/osqa/trunk
mv trunk osqa

copy osqa/settings\\_local.py.dist to osqa/settings\\_local.py and edit according to the INSTALL directions.

Finally, from the OSQA directory ( ~/.local/lib/python2.6/site-packages/osqa ) you must run:

python2.6 manage.py syncdb --all
python2.6 manage.py migrate --all
python2.6 manage.py migrate forum 0001 --fake
python2.6 manage.py runserver 95

And then press Ctrl-C to stop the local python server.

In your ~/public_html/osqa directory, create a file .htaccess with the following content:

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteRule ^(media.*)$ /$1 [QSA,L,PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ osqa.fcgi/$1 [QSA,L]

And create a file osqa.fcgi with the following content: note that there are three occurrences of USERNAME below - change each of them to your bluehost username

#!/usr/bin/python2.6
import sys, os
sys.path.insert(0, "/home/USERNAME/.local/lib/python2.6/site-packages")
sys.path.append("/home/USERNAME/.local/lib/python2.6/site-packages/osqa")
os.chdir("/home/USERNAME/.local/lib/python2.6/site-packages/osqa")
os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

Change its attributes to make osqa.fcgi executable:

chmod +x osqa.fcgi

Any time you change any of the *.py files, such as settings_local.py , then from SSH do

touch ~/public_html/osqa/osqa.fcgi

That touch tells the server realises that files have been updated. If you don't do this touch, your changes won't take effect.

Now, all being well, you should have a working OSQA installation!

link

answered 19 Apr '11, 18:39

Andrew_S's gravatar image

Andrew_S ♦
5.6k45674
accept rate: 21%

edited 23 Aug '11, 06:33

1

Andrew_S should be given a medal. The stranger helped me out via email, and when he saw I was hopeless = logged in and did the install for me. Its ppl like Andrew that make this world go around. Please vote him up!

(19 Apr '11, 19:35) Simon
1

there's a typo in "ptyhon2.6 manage.py migrate --all" -- ptyhon -> python

(23 Aug '11, 02:43) Catskul

Thanks Catskul - I've fixed both "ptyhon"s now

(23 Aug '11, 06:34) Andrew_S ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×156

Asked: 13 Apr '11, 02:35

Seen: 718 times

Last updated: 23 Aug '11, 06:34

powered by OSQA