apache2debianmod-wsgipython-2.6roundup

Setup Roundup with WSGI and Apache


I was install Roundup 1.4 by Debian Squeeze official repo and want to run it with my Apache server using mod_wsgi. Host configuration:

<VirtualHost *:80>
    ServerName support.domain.com

    WSGIScriptAlias / /var/roundup/support/apache/roundup.wsgi
    WSGIDaemonProcess support.roundup user=roundup group=roundup threads=25
    WSGIProcessGroup support.roundup

    <Directory /var/roundup/support>
        <Files roundup.wsgi>
            Order allow,deny
            Allow from all
        </Files>
    </Directory>

    # ... some logging configuration
</VirtualHost>

I was install tracker in /var/roundup/support using roundup-admin install, configure it and next initialise using roundup-admin initialise. Then I was created apache/roundup.wsgi:

from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)

When opening my site at http://support.domain.com (ofcourse this url is bit different) I have HTTP response 500 Internal Server Error and log with:

mod_wsgi (pid=17433): Exception occured processing WSGI script '/var/roundup/support/apache/roundup.wsgi'.
RuntimeError: response has not been started

What's going on? How to run roundup with wsgi (not cgi) properly? Or where to look why response has not been started?

EDIT


Roundup's install manual says that wsgi handler would look like this:

from wsgiref.simple_server import make_server

# obtain the WSGI request dispatcher
from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = 'demo'
app = RequestDispatcher(tracker_home)

httpd = make_server('', 8917, app)
httpd.serve_forever()

But this make no response. Browser loading it forever without message or server log. I think starting another server from script running by apache module isn't good idea. So I tried another code sample:

from roundup.cgi.wsgi_handler import RequestDispatcher
tracker_home = '/var/roundup/support'
application = RequestDispatcher(tracker_home)

from flup.server.fcgi import WSGIServer
WSGIServer(application).run()

But this throws some errors like:

WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!

There must be a way to run my application from RequestDispatcher...


Solution

  • According to this issue this is an permission's problem. Solved using:

    WSGIDaemonProcess support.roundup user=roundup group=roundup threads=25
    WSGIProcessGroup support.roundup
    

    where files in /var/roundup/support/ has roundup as owner and group with appropriate access permissions.