如何编写应用程序代码以检查在开发中运行的AppEngine应用程序与在Production中运行的应用程序之间的对比?
答案 0 :(得分:1)
您可以查看环境变量SERVER_SOFTWARE
# Check for appengine app identity.
app_env = os.getenv('SERVER_SOFTWARE', None)
if app_env:
if app_env.startswith('Google App Engine/'):
# Appengine Production
print("Appengine Production Detected")
if app_env.startswith("Development") or app_env.startswith("AppScaleServer"):
# Dev or appscale env
print("Local Dev / appscale detected")
else:
print("app_env not declared")