2
1

Hi All,

I'm hosting osqa on my VPS with CentOS 5 and nginx serves as web server. Running it with fast cgi but the page keeps getting me the following:

**Unhandled Exception**
An unhandled exception was thrown by the application.

Following is the server section for this virtual server I'm using:

   server {
        listen       9090;
        #listen       localhost:8080;
        server_name  localhost;
        index index.html;
        root /var/www/html/osqa;

location ~* ^.+\\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
        expires 30d;
        break;
    }
location /403.html {
  root   /usr/local/nginx;
  access_log   off;
}

location /401.html {
  root   /usr/local/nginx;
  access_log   off;
}

location /404.html {
  root   /usr/local/nginx;
  access_log   off;
}

location = /_.gif {
  empty_gif;
  access_log   off;
}

location / {
        root   /var/www/html/osqa;
        error_log  /var/www/html/osqa/log/error.log  info;
        fastcgi_pass 127.0.0.1:8080;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param SERVER_PORT $server_port;
        #fastcgi_param SERVER_ROOT /var/www/$server_root;
        fastcgi_pass_header Authorization;
        fastcgi_intercept_errors off;
   }

}

And I started the fast cgi using:

python manage.py runfcgi method=threaded host=127.0.0.1 port=8080 --settings=settings

Most interestingly, the python traceback is alway cut in half in the generated log file:

.

..

2011/01/19 18:57:37 [error] 4090#0: *70 FastCGI sent in stderr: "Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/flup-1.0.3.dev_20110111-py2.4.egg/flup/server/fcgi_base.py", line 574, in run File "/usr/lib/python2.4/site-packages/flup-1.0.3.dev_20110111-py2.4.egg/flup/server/fcgi_base.py", line 1159, in handler File "/usr/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 274, in call response = self.get_response(request) File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 169, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception return callback(request, param_dict) File "/usr/lib/python2.4/site-packages/django/utils/decorators.py", line 93, in _wrapped_view response = view_func(request, *args, kwargs) File "/usr/lib/python2.4/site-packages/django/views/defaults.py", line 31, in server_error return http.HttpResponseServerError(t.render(Context({}))) File "/usr/lib/python2.4/site-packages/django/template/base.py", line 123, in render return self._render(context) File "/usr/lib/python2.4/site-packages/django/template/base.py", line 117, in _render return self.nodelist.render(context) File "/usr/lib/python2.4/site-packages/django/template/base.py", line 744, in render bits.append(self.render_node(node, context)) File "/usr/lib/python2.4/site-packages/django/template/base.py", line 757, in render_node return node.render(context) File "/usr/lib/python2.4/site-packages/django/template/loader_tags.py", line 127, in render return compiled_parent._render(context) File "/usr/lib/python2.4/site-packages/django/template/base.py", line 117, in _render return self.nodelist.render(context) File "/usr/lib/python2.4/site-packages/django/template/base.py", line 744, in render bits.append(self.render_node(node, context)) File "/usr/lib/pyt

That's correct, it ends with "File "/usr/lib/pyt".

So my question is, is there anything I'm doing wrong? How can I continue the troubleshooting?

asked 19 Jan '11, 11:08

Simon%20Yan's gravatar image

Simon Yan
124236
accept rate: 100%

edited 11 Feb '11, 07:01

Switching to Python 2.6.x does not help resolving this issue. (I had 2.4.x)

(20 Jan '11, 10:00) Simon Yan

Nothing really progressed after a while so I'm going to setup a localhost development server to test it out.

(24 Jan '11, 22:26) Simon Yan

I am able to resolve this issue today. It was actually caused by a "bug" in osqa. From /var/www/html/osqa/forum/urls.py:

...
                        url(r'^$', app.readers.index, name='index'),
                        url(r'^%s(.*)' % _('nimda/'), admin.site.root),
...

It seems Django does not like admin.site.root:

...

File "/var/www/html/osqa/forum/urls.py", line 34, in <module>
    url(r'^%s(.*)' % _('nimda/'), admin.site.root),
AttributeError: 'AdminSite' object has no attribute 'root'
...

So I did a bit google search and found that you'll have to use admin.site.urls instead of admin.site.root in django 1.1 and after. After changing it to admin.site.urls it magically begin to work. (Some other issues still persist but they are separate ones)

link

answered 11 Feb '11, 07:00

Simon%20Yan's gravatar image

Simon Yan
124236
accept rate: 100%

edited 25 Feb '11, 09:18

Ran into this bug too with the fantasy-island-0.9.0-beta3 release using Python 2.7.1. This seems to have fixed it

(21 Jun '11, 13:07) TrinitronX

Thanks for commenting on this. We'll check and make sure this makes it into the next release.

(21 Jun '11, 20:57) matt ♦♦
1

This issue has already been fixed in Revisions #941 and #942:

  1. http://svn.osqa.net/changelog/OSQA/?cs=941
  2. http://svn.osqa.net/changelog/OSQA/?cs=942

It seems like you're using an old OSQA version.

(22 Jun '11, 07:15) Jordan ♦♦
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:

×6
×4

Asked: 19 Jan '11, 11:08

Seen: 1,029 times

Last updated: 22 Jun '11, 07:15

powered by OSQA