gae(1.7.2)不知道什么时候起不再内置web.py(0.37)了,怎么办 ,搜半天无果。
仔细看文档,看错误日志!先把web.py的包放到engineapp目录下,然后
main.py
import web urls = ( '/(.*)/', 'redirect', "/.*", "hello" ) app = web.application(urls, globals()) class hello: def GET(self): return 'Hello, gae + web.py' class redirect: def GET(self, path): web.seeother('/' + path) app = app.wsgifunc() #看这里
app.yaml(只是说明,非有效代码。原文件不需要做任何修改)
... - url: .* script: main.app <- 默认设置,指向main.py里定义的app(它必须是一个WSGI的实现) ...
或者
main.py
from google.appengine.ext.webapp.util import run_wsgi_app import web urls = ( '/(.*)', 'hello' ) app = web.application(urls, globals()) app = app.wsgifunc() class hello: def GET(self, name): return 'Hello, gae + web.py' def main(): run_wsgi_app(app) if __name__ == "__main__": main()
app.yaml
... threadsafe: no ... - url: .* script: main.py