Skip to content

Instantly share code, notes, and snippets.

@chan-lee
Created April 22, 2014 00:42
Show Gist options
  • Save chan-lee/11161579 to your computer and use it in GitHub Desktop.
Save chan-lee/11161579 to your computer and use it in GitHub Desktop.
using namespace 'test' in app engine when it runs by dev server or is called with subdomain 'test.'
# -*- coding: utf-8 -*-
import os
from google.appengine.api import namespace_manager
def namespace_manager_default_namespace_for_request():
if 'test' in os.environ['SERVER_NAME'] or 'Dev' in os.environ['SERVER_SOFTWARE']:
return 'test'
return namespace_manager.google_apps_namespace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment