How to run the CherryPy web server in the Google App Engine

[亡魂溺海] 提交于 2019-11-30 14:55:38
RoutineOp

The article is a good example but its slightly out of date now as the patch is no longer required, the latest version of Cherrypy should run without it, I've gotten the sample below running in the development environment. I've included cherrypy inside a zip file as the google app engine has a limit of one thousand files per application, it also makes it easier to deploy.

I'm also using the cherrypy dispatch handler to route the request.

 import sys
    sys.path.insert(0, 'cherrypy.zip')
    import cherrypy
    import wsgiref.handlers 

    class Root:
        exposed = True
        def GET(self):
            return "give a basic description of the service"

    d = cherrypy.dispatch.MethodDispatcher()
    conf = {'/': 
            {
             'request.dispatch': d
            }
           }

    app = cherrypy.tree.mount(Root(), "/",conf)
    wsgiref.handlers.CGIHandler().run(app)

So far I've not come across any particular issues but I have read some people have had issues with sessions.

Shiroyuki

See boodebr.org article (missing, but here on the Wayback machine) It works for me.

If you are looking for an example, look for the condition that accepts ServerMode.GAE in ServerInterface.auto in this example.

Jack M.

There is a good article on how to do this over here now here. I haven't actually tried this yet, I stuck with django on App Engine, but it seems to be a solid example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!