Dan O'Boyle
Dan O'Boyle

Reputation: 3766

How can I check Dev vs Prod in Appengine?

How can I write application code to check between AppEngine applications running in development vs running in Production?

Upvotes: 1

Views: 134

Answers (1)

Dan O'Boyle
Dan O'Boyle

Reputation: 3766

You can check the enviornmental variable 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")

Upvotes: 1

Related Questions