I am trying to get web.py working.

I have compiled mod_wsgi to use python2.6, and configured my virtualhost correctly (at least I am pretty sure it is!). The hello, world application keeps showing up as 404. I changed the loglevel of Apache to info. and am seeing the following:

[Wed Sep 28 15:41:12 2011] [info] mod_wsgi (pid=25969): Attach interpreter ''.
[Wed Sep 28 15:42:55 2011] [info] mod_wsgi (pid=25969): Create interpreter 'clearpoint.turnleftllc.com|/budgetcalculator'.
[Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Destroying interpreters.
[Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Destroy interpreter 'clearpoint.turnleftllc.com|/budgetcalculator'.
[Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Cleanup interpreter ''.
[Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Terminating Python.
[Wed Sep 28 15:45:33 2011] [error] Exception KeyError: KeyError(-1216178416,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored
[Wed Sep 28 15:45:33 2011] [info] mod_wsgi (pid=25969): Python has shutdown.
Fatal Python error: Interpreter not initialized (version mismatch?)

Regarding the KeyError, I am really not sure where that is coming from. I tested the application from the command line (python26 code.py) and it executes without error. It gives no output whatsoever in fact.

Just in case, here is my VirtualHost configuration, as well as the application code:

Python Code (taken directly from the web.py site):

import web

urls = (
        '/.*', 'index'

class index:
    def GET(self):
        return "Hello, world!"

app = web.application(urls,globals()).wsgifunc()


<VirtualHost xxx.xxx.xxx.xxx:80>
        ServerAdmin "tom@turnleftllc.com"
        ServerName clearpoint.turnleftllc.com
        ServerAlias clearpoint
        ErrorLog logs/clearpoint_error_log

        DocumentRoot /home/turnleftllc/public_html/cpccs
        WSGIScriptAlias /budgetCalculator /home/turnleftllc/public_html/cpccs/apps/code.py
        Alias /budgetCalculator/static /home/turnleftllc/public_html/cpccs/apps/static
        AddType text/html .py
        <Directory /home/turnleftllc/public_html/cpccs>
                Order allow,deny
                Allow from all
                AllowOverride All
        <Directory /home/turnleftllc/public_html/cpccs/apps>
                Order allow,deny
                Allow from all

I am using CentOS5, which defaults to python2.4. I did uninstall and recompile mod_wsgi for python2.6 (as you can see in the output, it's definitely initializing 2.6).

Any help would be greatly appreciated!


Make sure you aren't still loading mod_python into same Apache.

Read the following and validate your installation.

http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use


The KeyError message is because you are using old mod_wsgi version and not the latest so if you built from source code make sure you used mod_wsgi 3.3.

| improve this answer | |
  • I definitely don't have mod_python in use.I did install 3.1; I'll try 3.3 instead and see if it helps! – Thomas Thorogood Sep 29 '11 at 3:42
  • Ah. never mind. I grepped around a bit. There was a separate .conf file that was loaded which had mod_python enabled. Good catch. Still not working right, but at least it's progress. Thanks for the help! – Thomas Thorogood Sep 29 '11 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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