本文整理汇总了Python中google.appengine.ext.webapp.util.run_wsgi_app方法的典型用法代码示例。如果您正苦于以下问题:Python util.run_wsgi_app方法的具体用法?Python util.run_wsgi_app怎么用?Python util.run_wsgi_app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google.appengine.ext.webapp.util
的用法示例。
在下文中一共展示了util.run_wsgi_app方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
def main():
# Run the WSGI CGI handler with that application.
util.run_wsgi_app(app)
示例2: main
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
def main():
util.run_wsgi_app(APP)
示例3: _main
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
def _main():
webapp_util.run_wsgi_app(_APP)
示例4: run
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
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)
示例5: cgirun
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
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)
示例6: run
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
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)
示例7: gaerun
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
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)
示例8: run
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
def run(self, handler):
from google.appengine.ext.webapp import util
util.run_wsgi_app(handler)
示例9: main
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
def main():
util.run_wsgi_app(app)
示例10: webapp_main
# 需要导入模块: from google.appengine.ext.webapp import util [as 别名]
# 或者: from google.appengine.ext.webapp.util import run_wsgi_app [as 别名]
def webapp_main():
"""Run within webapp framework.
"""
# Ofcourse, instead allowing solely Google Accounts and using the integrated
# system, this recipe could be extended to also login other accounts.
# However, there the automatic Cookie checking would obviously fail and you
# would need to do ones own checking. Possibly by using a session instead of
# cookies, by using other cookies, or by simply having each HTTP request
# Authorized; unlike this recipe. This is two-legged authentication, so the
# latter would not be advised (doing (re)authentication for repeated requests).
#from gaesessions import SessionMiddleware
#run_wsgi_app(SessionMiddleware(application))
run_wsgi_app(application)