在Python中,如何测试我是否在Google App Engine SDK中? [英] In Python, how can I test if I'm in Google App Engine SDK?
问题描述
在开发时,我想处理一些与我最终上传到Google服务器时不同的事情。
是否有快速测试可以确定我是在SDK还是在线?
请参阅: https:/ /cloud.google.com/appengine/docs/python/how-requests-are-handled#Python_The_environment
以下内容环境变量是CGI标准的一部分,在App Engine中有特殊的行为:
SERVER_SOFTWARE
:
在开发Web服务器中,此值为
Development / XY
,其中XY
是运行时的版本。
$ b在App Engine上运行时,此值为
Google App Engine / XYZ
。
Whilst developing I want to handle some things slight differently than I will when I eventually upload to the Google servers.
Is there a quick test that I can do to find out if I'm in the SDK or live?
See: https://cloud.google.com/appengine/docs/python/how-requests-are-handled#Python_The_environment
The following environment variables are part of the CGI standard, with special behavior in App Engine:
SERVER_SOFTWARE
:In the development web server, this value is "
Development/X.Y
" where "X.Y
" is the version of the runtime.When running on App Engine, this value is "
Google App Engine/X.Y.Z
".
这篇关于在Python中,如何测试我是否在Google App Engine SDK中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!