Johannes Charra
Johannes Charra

Reputation: 29953

web.py on Google App Engine

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?

Upvotes: 9

Views: 2196

Answers (2)

systempuntoout
systempuntoout

Reputation: 74134

Here is a snippet of StackPrinter, a webpy application 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()

Upvotes: 11

xj9
xj9

Reputation: 3471

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()

Upvotes: 0

Related Questions