Created
June 6, 2010 22:59
-
-
Save jdennes/428005 to your computer and use it in GitHub Desktop.
An interactive console for App Engine apps
This file contains 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
#!/usr/bin/python | |
# An interactive console for App Engine apps | |
# Usage: ./appengine_console.py app_id [host] | |
import code | |
import getpass | |
import sys | |
sys.path.append("/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine") | |
sys.path.append("/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/yaml/lib") | |
from google.appengine.ext.remote_api import remote_api_stub | |
from google.appengine.ext import db | |
def auth_func(): | |
return raw_input('Username:'), getpass.getpass('Password:') | |
if len(sys.argv) < 2: | |
print "Usage: %s app_id [host]" % (sys.argv[0],) | |
app_id = sys.argv[1] | |
if len(sys.argv) > 2: | |
host = sys.argv[2] | |
else: | |
host = '%s.appspot.com' % app_id | |
remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host) | |
code.interact('App Engine interactive console for %s' % (app_id,), None, locals()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment