Created
November 30, 2016 18:39
-
-
Save ramuta/86fac8720bf00897bef0afbf309e8bf4 to your computer and use it in GitHub Desktop.
Check if on localhost (GAE)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: