codekingpro/portable-devtools
114k
1"""2This module provides means to detect the App Engine environment.3"""4 5import os6 7 8def is_appengine():9 return is_local_appengine() or is_prod_appengine()10 11 12def is_appengine_sandbox():13 """Reports if the app is running in the first generation sandbox.14 15 The second generation runtimes are technically still in a sandbox, but it16 is much less restrictive, so generally you shouldn't need to check for it.17 see https://cloud.google.com/appengine/docs/standard/runtimes18 """19 return is_appengine() and os.environ["APPENGINE_RUNTIME"] == "python27"20 21 22def is_local_appengine():23 return "APPENGINE_RUNTIME" in os.environ and os.environ.get(24 "SERVER_SOFTWARE", ""25 ).startswith("Development/")26 27 28def is_prod_appengine():29 return "APPENGINE_RUNTIME" in os.environ and os.environ.get(30 "SERVER_SOFTWARE", ""31 ).startswith("Google App Engine/")32 33 34def is_prod_appengine_mvms():35 """Deprecated."""36 return False37 