tags:

views:

62

answers:

2

Suppose I have a function

def app2(environ, start_response)

If I know that a server implements WSGI, how can I tell the server to call app2 when it receives a HTTP request? app2 here is a function that takes a dictionary and returns a response (a WSGI application).

A: 

Depends on the server. The WSGI-Spec says nothing about that. But mod_wsgi for example expects to find the WSGI-Applications under the name application in the specified module, but you can configure that with the WSGICallableObject configuration directive.

nils
Okay thanks! Do you know what Google appengine expects the function to be called?
Mark
A: 

If, as it sounds from your comment, your question is about Google App Engine, it provides a convenience function run_wsgi_app for running WSGI apps. So if your function is called app2, you would run

def main():
   run_wsgi_app(app2)

For more, see http://code.google.com/appengine/docs/python/tools/webapp/utilmodule.html#run_wsgi_app

DS
Oh that is just what I needed, thank you.
Mark