Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
2  
It is mod_wsgi that requires the WSGI application entry point be called 'application'. It is not a requirement of the WSGI specification. There is a mod_wsgi directive which allows you to override the name looked for if necessary. –  Graham Dumpleton Nov 24 at 10:43
add comment

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.