Skip to content

Instantly share code, notes, and snippets.

@gregorynicholas
Created February 2, 2012 18:38
Show Gist options
  • Save gregorynicholas/1725041 to your computer and use it in GitHub Desktop.
Save gregorynicholas/1725041 to your computer and use it in GitHub Desktop.
Configure default shell python interpreter to load google appengine SDK on OSX
# python
export PYTHONDONTWRITEBYTECODE=1
export PYTHONSTARTUP="~/.pythonrc"
# Configure default shell python interpreter to load google appengine
# setup automatically
import os
import sys
# Appengine Server Settings
os.environ['SERVER_SOFTWARE'] = 'Development/1.0'
os.environ['APPENGINE_RUNTIME'] = 'python27'
os.environ['SDK_VERSION'] = '1.6.1'
# Appengine Application Settings
os.environ['SERVER_NAME'] = 'shellapp'
os.environ['APPLICATION_ID'] = 'dev~shellapp'
os.environ['CURRENT_VERSION_ID'] = 'dev.1'
sys.path.append('/usr/local/google_appengine')
import dev_appserver
dev_appserver.fix_sys_path()
from google.appengine.api import apiproxy_stub_map, datastore_file_stub
if 'datastore' in apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map:
del apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map['datastore']
if 'datastore_v3' in apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map:
del apiproxy_stub_map.apiproxy._APIProxyStubMap__stub_map['datastore_v3']
stub_path = '/dev/null'
stub = datastore_file_stub.DatastoreFileStub(
os.environ['APPLICATION_ID'], stub_path, stub_path)
apiproxy_stub_map.apiproxy.RegisterStub('datastore', stub)
import google.appengine.ext.db as db
from google.appengine.api import memcache
print 'Google Appengine stubs configured.\nThe db, memcache modules are already loaded'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment