简体   繁体   English

Google App Engine上的web.py.

[英]web.py on Google App Engine

I'm trying to get a web.py application running on GAE. 我正在尝试在GAE上运行web.py应用程序。 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. 但很明显, app对象不符合run_wsgi_app函数的期望。 The error msg says sth like app has no __call__ function , so I tried passing app.run instead, but that didn't work either. 错误消息msg说app has no __call__ function ,所以我尝试传递app.run ,但这也不起作用。

How can I make the call to run_wsgi_app work? 如何调用run_wsgi_app工作?

Here is a snippet of StackPrinter , a webpy application that runs on top of Google App Engine. 这里是一个片段StackPrinter ,一个webpy是在谷歌应用程序引擎之上运行的应用程序。

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

You don't need to import or use run_wsgi_app, web.py has a runcgi method that works perfectly! 您不需要导入或使用run_wsgi_app,web.py有一个完美运行的runcgi方法!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM