Question

I am trying to get web.py to work with Apache. I'm following the instructions here: Web.py + Apache with mod_wsgi

This is what my httpd.conf looks like right now:

LoadModule wsgi_module modules/mod_wsgi.so

WSGIScriptAlias /justcompare /var/www/justcompare/code.py

Alias /justcompare/static /var/www/justcompare/static
AddType text/html .py

<Directory /var/www/justcompare/>
    Order deny,allow
    Allow from all
</Directory>

My code.py can be seen here. The server returns a 404 not found when I try to visit [server's ip]/justcompare. Apache's error log is a little more enlightening. It says:

[Sun Nov 24 03:15:40 2013] [error] [client 192.168.1.100] mod_wsgi (pid=5489): Target WSGI script '/var/www/justcompare/code.py' does not contain WSGI application 'application'.

What am i doing wrong?

Was it helpful?

Solution

A mod_wsgi compliant script should contain the name 'application' (the name is configurable through a mod_wsgi directive), which must be a WSGI compliant application object. If you do as the linked page says and remove "if __name__ == '__main__" and rename 'app' to 'application', it should work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top