Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

64-bit Win7 Apache 2.2.19, mod_wsgi/3.4-BRANCH Python/2.7.3

No errors visible in logs:

[Wed Aug 01 17:44:48 2012] [notice] Apache/2.2.19 (Win64) mod_wsgi/3.4-BRANCH Python/2.7.3 configured -- resuming normal operations
[Wed Aug 01 17:44:48 2012] [notice] Server built: May 28 2011 15:18:56
[Wed Aug 01 17:44:48 2012] [notice] Parent: Created child process 8528
[Wed Aug 01 17:44:48 2012] [debug] mpm_winnt.c(477): Parent: Sent the scoreboard to the child
[Wed Aug 01 17:44:48 2012] [notice] Child 8528: Child process is running
[Wed Aug 01 17:44:48 2012] [debug] mpm_winnt.c(398): Child 8528: Retrieved our scoreboard from the parent.
[Wed Aug 01 17:44:48 2012] [info] Parent: Duplicating socket 556 and sending it to child process 8528
[Wed Aug 01 17:44:48 2012] [debug] mpm_winnt.c(595): Parent: Sent 1 listeners to child 8528
[Wed Aug 01 17:44:48 2012] [debug] mpm_winnt.c(554): Child 8528: retrieved 1 listeners from parent
[Wed Aug 01 17:44:48 2012] [info] mod_wsgi (pid=8528): Initializing Python.
[Wed Aug 01 17:44:48 2012] [info] mod_wsgi (pid=8528): Attach interpreter ''.
[Wed Aug 01 17:44:48 2012] [notice] Child 8528: Acquired the start mutex.
[Wed Aug 01 17:44:48 2012] [notice] Child 8528: Starting 64 worker threads.
[Wed Aug 01 17:44:48 2012] [notice] Child 8528: Starting thread to listen on port 80.

Config straight out of guides:

WSGIScriptAlias /wsgi "C:/Program Files/Apache Software Foundation/Apache2.2/wsgi/wsgi_test.py"

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/wsgi/">
    Order allow,deny
    Allow from all
</Directory>

WSGI app:

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World from wsgi!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

Get 403 and log message:

Options ExecCGI is off in this directory: C:/Program Files/Apache Software Foundation/Apache2.2/wsgi/wsgi_test.py

Add Options +ExecCGI to Directory (and stick "#!c:\Python27\python.exe" at top of app file) Get 500 and log message:

Premature end of script headers: wsgi_test.py

Straight python as scripting language via ExecCGI works fine, with #!... at top of script and ExecCGI config for another Directory, etc.

Implication is that WSGIScriptAlias is behaving a lot like Alias and not setting ExecCGI or invoking properly to call the application() function.

How do I debug ? Or is there something obvious missing ?

share|improve this question
    
Thanks to Raymond Tau for formatting. –  rickL Aug 2 '12 at 17:46

1 Answer 1

up vote 0 down vote accepted

Your configuration isn't even being used as is picking up CGI configuration from else where in the Apache configuration.

Rename your file to wsgi_test.wsgi and change the WSGIScriptAlias directive correspondingly and it may become more obvious what the issue is. Technically the CGI definition for .py should not override WSGIScriptAlias.

share|improve this answer
    
This was the problem - thanks very much Graham. –  rickL Aug 2 '12 at 17:45
    
That doesn't resolve the real problem as WSGIScriptAlias should override an AddHandler/SetHandler definition. –  Graham Dumpleton Aug 2 '12 at 23:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.