views:

56

answers:

2

I'm trying to get a web.py application running on GAE. I hoped that sth like the following might work

import web
from google.appengine.ext.webapp.util import run_wsgi_app

[...]

def main():
    app = web.application(urls, globals())
    run_wsgi_app(app)

But obviously the app object doesn't conform with the run_wsgi_app function's expectations. The error msg says sth like app has no __call__ function, so I tried passing app.run instead, but that didn't work either.

How can I make the call to run_wsgi_app work?

+2  A: 

Here a snippet of StackPrinter, a webpy app that runs on top of Google App Engine.

from google.appengine.ext.webapp.util import run_wsgi_app
import web
...
app = web.application(urls, globals())

def main():

    application = app.wsgifunc()
    run_wsgi_app(application)

if __name__ == '__main__':
    main()
systempuntoout
Cool, thanks a lot.
jellybean
A: 

You don't need to import or use run_wsgi_app, web.py has a runcgi method that works perfectly!

if __name__  == '__main__':
    app.cgirun()
indieinvader