我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用google.appengine.ext.webapp.util.run_wsgi_app()。
def run(self, bare=False): """Runs this WSGI-compliant application in a CGI environment. This uses functions provided by ``google.appengine.ext.webapp.util``, if available: ``run_bare_wsgi_app`` and ``run_wsgi_app``. Otherwise, it uses ``wsgiref.handlers.CGIHandler().run()``. :param bare: If True, doesn't add registered WSGI middleware: use ``run_bare_wsgi_app`` instead of ``run_wsgi_app``. """ if _webapp_util: if bare: _webapp_util.run_bare_wsgi_app(self) else: _webapp_util.run_wsgi_app(self) else: # pragma: no cover handlers.CGIHandler().run(self)
def run(self, handler): depr(0, 13, "AppEngineServer no longer required", "Configure your application directly in your app.yaml") from google.appengine.ext.webapp import util # A main() function in the handler script enables 'App Caching'. # Lets makes sure it is there. This _really_ improves performance. module = sys.modules.get('__main__') if module and not hasattr(module, 'main'): module.main = lambda: util.run_wsgi_app(handler) util.run_wsgi_app(handler)
def run(self, handler): from google.appengine.ext.webapp import util # A main() function in the handler script enables 'App Caching'. # Lets makes sure it is there. This _really_ improves performance. module = sys.modules.get('__main__') if module and not hasattr(module, 'main'): module.main = lambda: util.run_wsgi_app(handler) util.run_wsgi_app(handler)
def run(self, handler): from google.appengine.ext.webapp import util util.run_wsgi_app(handler)
def real_main(): # Reset path and environment variables global path_backup try: sys.path = path_backup[:] except: path_backup = sys.path[:] os.environ.update(aecmd.env_ext) setup_logging() # Create a Django application for WSGI. application = django.core.handlers.wsgi.WSGIHandler() # Run the WSGI CGI handler with that application. util.run_wsgi_app(application)
def cgirun(self, *middleware): """ Return a CGI handler. This is mostly useful with Google App Engine. There you can just do: main = app.cgirun() """ wsgiapp = self.wsgifunc(*middleware) try: from google.appengine.ext.webapp.util import run_wsgi_app return run_wsgi_app(wsgiapp) except ImportError: # we're not running from within Google App Engine return wsgiref.handlers.CGIHandler().run(wsgiapp)
def gaerun(self, *middleware): """ Starts the program in a way that will work with Google app engine, no matter which version you are using (2.5 / 2.7) If it is 2.5, just normally start it with app.gaerun() If it is 2.7, make sure to change the app.yaml handler to point to the global variable that contains the result of app.gaerun() For example: in app.yaml (where code.py is where the main code is located) handlers: - url: /.* script: code.app Make sure that the app variable is globally accessible """ wsgiapp = self.wsgifunc(*middleware) try: # check what version of python is running version = sys.version_info[:2] major = version[0] minor = version[1] if major != 2: raise EnvironmentError("Google App Engine only supports python 2.5 and 2.7") # if 2.7, return a function that can be run by gae if minor == 7: return wsgiapp # if 2.5, use run_wsgi_app elif minor == 5: from google.appengine.ext.webapp.util import run_wsgi_app return run_wsgi_app(wsgiapp) else: raise EnvironmentError("Not a supported platform, use python 2.5 or 2.7") except ImportError: return wsgiref.handlers.CGIHandler().run(wsgiapp)
def main(): """Main program. Run the Django WSGIApplication.""" util.run_wsgi_app(app)
def main(): util.run_wsgi_app(APP)
def main(): """Main program. This is invoked when this package is referenced from app.yaml. """ application = webapp.WSGIApplication([('/([^/]+)/(.*)', ZipHandler)]) util.run_wsgi_app(application)