1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.