You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_appengine_environ.py 717B

123456789101112131415161718192021222324252627282930
  1. """
  2. This module provides means to detect the App Engine environment.
  3. """
  4. import os
  5. def is_appengine():
  6. return (is_local_appengine() or
  7. is_prod_appengine() or
  8. is_prod_appengine_mvms())
  9. def is_appengine_sandbox():
  10. return is_appengine() and not is_prod_appengine_mvms()
  11. def is_local_appengine():
  12. return ('APPENGINE_RUNTIME' in os.environ and
  13. 'Development/' in os.environ['SERVER_SOFTWARE'])
  14. def is_prod_appengine():
  15. return ('APPENGINE_RUNTIME' in os.environ and
  16. 'Google App Engine/' in os.environ['SERVER_SOFTWARE'] and
  17. not is_prod_appengine_mvms())
  18. def is_prod_appengine_mvms():
  19. return os.environ.get('GAE_VM', False) == 'true'