Skip to content

Instantly share code, notes, and snippets.

@ramuta
Created November 30, 2016 18:39
Show Gist options
  • Save ramuta/86fac8720bf00897bef0afbf309e8bf4 to your computer and use it in GitHub Desktop.
Save ramuta/86fac8720bf00897bef0afbf309e8bf4 to your computer and use it in GitHub Desktop.
Check if on localhost (GAE)
def is_local():
if os.environ.get('SERVER_NAME', '').startswith('localhost'):
return True
elif 'development' in os.environ.get('SERVER_SOFTWARE', '').lower():
return True
else:
return False
@ramuta
Copy link
Author

ramuta commented Nov 30, 2016

Usage:

if is_local():
    time.sleep(1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment