在 Python 中,如何测试我是否在 Google App Engine SDK 中? [英] In Python, how can I test if I'm in Google App Engine SDK?

查看:19
本文介绍了在 Python 中,如何测试我是否在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆