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