Hi,

I've problem, as advised on this site I ordered hosting @site5. I followed the documentation word by word and am fairly sure I did everything. But when I visit my site, I'm greeted with an internal server error 500 message. I tried to look into log files, and it seems that .htaccess is causing the problem.

First time, I used default .htaccess and osqa.fcgi code as described in the how to. And I got error:

File "./osqa.fcgi", line 4 _PROJECT_DIR = ^ SyntaxError: invalid syntax

But after I saw error, I searched here and found some type of fix, so I changed both files to:

.htaccess

AddHandler fcgid-script .fcgi
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ osqa.fcgi/$1 [QSA,L]

And osqa.fcgi

#!/home/[USERNAME]/local/bin/python
import os, sys

_PROJECT_DIR = '/home/[USERNAME]/osqa' sys.path.insert(0, _PROJECT_DIR) sys.path.insert(0, os.path.dirname(_PROJECT_DIR))

_PROJECT_NAME = _PROJECT_DIR.split('/')[-1] os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME

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

New error is related to .htaccess file

[alert] [client 94.189.180.217] /home/photog/public_html/.htaccess: RewriteCond: bad flag delimiters

Any help appreciated,

thanks!

asked 31 May '11, 03:58

Sandro%20Dzneladze's gravatar image

Sandro Dznel...
1812816
accept rate: 50%

edited 31 May '11, 10:22

Andrew_S's gravatar image

Andrew_S ♦
5.6k45674

I reverted back to .htaccess and fcgi file as seen in the how to.

Now I get this error:

[Tue May 31 07:54:01 2011] [warn] [client 66.249.71.185] mod_fcgid: stderr: File "/home/photog/osqa/forum/models/base.py", line 168, in iterator

[Tue May 31 07:54:01 2011] [warn] [client 66.249.71.185] mod_fcgid: stderr: File "/home/photog/osqa/forum/badges/base.py", line 12, in <module>

[Tue May 31 07:54:01 2011] [warn] [client 66.249.71.185] mod_fcgid: stderr: File "/home/photog/osqa/forum/badges/init.py", line 5, in <module>

[Tue May 31 07:54:01 2011] [warn] [client 66.249.71.185] mod_fcgid: stderr: File "/home/photog/osqa/forum/views/meta.py", line 17, in <module>

[Tue May 31 07:54:01 2011] [warn] [client 66.249.71.185] mod_fcgid: stderr: File "/home/photog/osqa/forum/views/init.py", line 5, in <module>

(31 May '11, 08:58) Sandro Dznel...

That project_dir line on line 4 of osqa.wsgi - does it actually say "[USERNAME]" in the middle, or have you substituted your username in there? e.g. if your username is sandro, does it now say:

_PROJECT_DIR = '/home/sandro/osqa'
(31 May '11, 09:35) Andrew_S ♦

:) that would be a fun oversight, but no I put my username there... /home/photog/osqa

(31 May '11, 09:57) Sandro Dznel...

Oh, it's easily done - I've done it myself.

Can you SSH into the server, open a Python shell, and try executing the lines in osqa.fcgi one by one? See if that gives us any clues.

What versions of Python and of Django do you have?

(31 May '11, 10:19) Andrew_S ♦

My knowledge of python is limited.

One thing that came to my mind when looking over the how to file. Is that I skipped this part: .bashrc

export PATH=$HOME/local/bin:$PATH

.bash_profile

if [ -f ~/.bashrc ]; then source ~/.bashrc fi

Mainly due to wording used in the guide. Which was "You may want to create .bashrc and/or .bash_profile files like the following (or add these lines to your existing files)"

So I thought this wasn't necessary? could problem be related to this??

I don't have access to SSH right now, Im at work and we are jailed here... will try when I get home!

(31 May '11, 10:25) Sandro Dznel...

Python 2.6.1 (python -v) django I don't know how to check...

How do I execute osqa.fcgi? any hints?

On my site, start page: Unhandled Exception An unhandled exception was thrown by the application.

(31 May '11, 12:41) Sandro Dznel...

right, first you start a python shell: python

Have osqa.fcgi visible in a file viewer elsewhere on your screen. Now enter each line from that, one at a time (starting at the top), into the python shell, and press enter after each line, until you get an error.

(31 May '11, 17:38) Andrew_S ♦

ok, for this line: PROJECT_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(file))), 'osqa')

I get: Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'file' is not defined

and than: sys.path.insert(0, _PROJECT_DIR)

Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_PROJECT_DIR' is not defined

(01 Jun '11, 01:04) Sandro Dznel...

I give up. This is not going anywhere... :(

(02 Jun '11, 03:08) Sandro Dznel...
showing 5 of 9 show 4 more comments

Ok, I'm tracing back the steps I took. And I see this error when I try to run command: python2.6 virtualenv-1.4.9/virtualenv.py $HOME/local

> Please use the *system* python to run this script
Traceback (most recent call last):
  File "virtualenv-1.4.9/virtualenv.py", line 1489, in <module>
    main()
  File "virtualenv-1.4.9/virtualenv.py", line 526, in main
    use_distribute=options.use_distribute)
  File "virtualenv-1.4.9/virtualenv.py", line 609, in create_environment
    site_packages=site_packages, clear=clear))
  File "/usr/local/lib/python2.6/posixpath.py", line 336, in abspath
    if not isabs(path):
  File "/usr/local/lib/python2.6/posixpath.py", line 52, in isabs
    return s.startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'

p.s. python 2.6, django 1.1.1

link

answered 31 May '11, 12:48

Sandro%20Dzneladze's gravatar image

Sandro Dznel...
1812816
accept rate: 50%

edited 01 Jun '11, 05:20

Andrew_S's gravatar image

Andrew_S ♦
5.6k45674

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
×113
×38
×8

Asked: 31 May '11, 03:58

Seen: 701 times

Last updated: 02 Jun '11, 03:08

powered by OSQA