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

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

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